diff --git a/.gitignore b/.gitignore index 9c518f6a..b596dbd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +/funcs +/core.* +/esm +/dist +/.tshy +/.tshy-* /hooks /models /models/errors diff --git a/.npmignore b/.npmignore index 709e6847..3ef05d12 100644 --- a/.npmignore +++ b/.npmignore @@ -5,3 +5,5 @@ /.eslintrc.js /cjs +/.tshy +/.tshy-* diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1b192624..f4c02c20 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 16f22cbf-f23f-4419-8924-3a4b06381947 management: - docChecksum: e73920abd3a55e8d249592f2e3090574 + docChecksum: 2ad2b4c59994082e04faa0c3e7675f3e docVersion: 0.0.3 - speakeasyVersion: 1.323.0 - generationVersion: 2.356.0 - releaseVersion: 0.18.2 - configChecksum: f685b81e83e5dfee0dae18eae6baa522 + speakeasyVersion: 1.377.1 + generationVersion: 2.404.1 + releaseVersion: 0.19.0 + configChecksum: 685039d8e4f59693f709afebf0849817 repoURL: https://github.com/LukeHagar/plexjs.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexjs @@ -14,10 +14,13 @@ management: features: typescript: additionalDependencies: 0.1.0 - constsAndDefaults: 0.1.5 - core: 3.10.2 + constsAndDefaults: 0.1.10 + core: 3.14.1 + defaultEnabledRetries: 0.1.0 + deprecations: 2.81.1 + envVarSecurityUsage: 0.1.1 flattening: 2.81.1 - globalSecurity: 2.82.9 + globalSecurity: 2.82.11 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.4 @@ -26,10 +29,82 @@ features: nameOverrides: 2.81.2 nullables: 0.1.0 responseFormat: 0.2.3 + retries: 2.83.0 sdkHooks: 0.1.0 typeOverrides: 2.81.1 - unions: 2.85.5 + unions: 2.85.7 generatedFiles: + - src/funcs/serverGetServerCapabilities.ts + - src/funcs/serverGetServerPreferences.ts + - src/funcs/serverGetAvailableClients.ts + - src/funcs/serverGetDevices.ts + - src/funcs/serverGetServerIdentity.ts + - src/funcs/serverGetMyPlexAccount.ts + - src/funcs/serverGetResizedPhoto.ts + - src/funcs/serverGetServerList.ts + - src/funcs/mediaMarkPlayed.ts + - src/funcs/mediaMarkUnplayed.ts + - src/funcs/mediaUpdatePlayProgress.ts + - src/funcs/videoGetTimeline.ts + - src/funcs/videoStartUniversalTranscode.ts + - src/funcs/activitiesGetServerActivities.ts + - src/funcs/activitiesCancelServerActivities.ts + - src/funcs/butlerGetButlerTasks.ts + - src/funcs/butlerStartAllTasks.ts + - src/funcs/butlerStopAllTasks.ts + - src/funcs/butlerStartTask.ts + - src/funcs/butlerStopTask.ts + - src/funcs/plexGetCompanionsData.ts + - src/funcs/plexGetUserFriends.ts + - src/funcs/plexGetGeoData.ts + - src/funcs/plexGetHomeData.ts + - src/funcs/plexGetResources.ts + - src/funcs/plexGetPin.ts + - src/funcs/plexGetTokenByPinId.ts + - src/funcs/plexGetUserDetails.ts + - src/funcs/hubsGetGlobalHubs.ts + - src/funcs/hubsGetLibraryHubs.ts + - src/funcs/searchPerformSearch.ts + - src/funcs/searchPerformVoiceSearch.ts + - src/funcs/searchGetSearchResults.ts + - src/funcs/libraryGetFileHash.ts + - src/funcs/libraryGetRecentlyAdded.ts + - src/funcs/libraryGetLibraries.ts + - src/funcs/libraryGetLibrary.ts + - src/funcs/libraryDeleteLibrary.ts + - src/funcs/libraryGetLibraryItems.ts + - src/funcs/libraryRefreshLibrary.ts + - src/funcs/librarySearchLibrary.ts + - src/funcs/libraryGetMetadata.ts + - src/funcs/libraryGetMetadataChildren.ts + - src/funcs/libraryGetTopWatchedContent.ts + - src/funcs/libraryGetOnDeck.ts + - src/funcs/logLogLine.ts + - src/funcs/logLogMultiLine.ts + - src/funcs/logEnablePaperTrail.ts + - src/funcs/playlistsCreatePlaylist.ts + - src/funcs/playlistsGetPlaylists.ts + - src/funcs/playlistsGetPlaylist.ts + - src/funcs/playlistsDeletePlaylist.ts + - src/funcs/playlistsUpdatePlaylist.ts + - src/funcs/playlistsGetPlaylistContents.ts + - src/funcs/playlistsClearPlaylistContents.ts + - src/funcs/playlistsAddPlaylistContents.ts + - src/funcs/playlistsUploadPlaylist.ts + - src/funcs/authenticationGetTransientToken.ts + - src/funcs/authenticationGetSourceConnectionInformation.ts + - src/funcs/statisticsGetStatistics.ts + - src/funcs/statisticsGetResourcesStatistics.ts + - src/funcs/statisticsGetBandwidthStatistics.ts + - src/funcs/sessionsGetSessions.ts + - src/funcs/sessionsGetSessionHistory.ts + - src/funcs/sessionsGetTranscodeSessions.ts + - src/funcs/sessionsStopTranscodeSession.ts + - src/funcs/updaterGetUpdateStatus.ts + - src/funcs/updaterCheckForUpdates.ts + - src/funcs/updaterApplyUpdates.ts + - src/funcs/userPostUsersSigninData.ts + - src/funcs/watchlistGetWatchlist.ts - src/sdk/server.ts - src/sdk/media.ts - src/sdk/video.ts @@ -45,19 +120,25 @@ generatedFiles: - src/sdk/statistics.ts - src/sdk/sessions.ts - src/sdk/updater.ts + - src/sdk/user.ts - src/sdk/watchlist.ts - src/sdk/sdk.ts - .eslintrc.cjs - .npmignore + - FUNCTIONS.md - RUNTIMES.md - jsr.json - package.json + - src/core.ts - src/index.ts - src/lib/base64.ts - src/lib/config.ts + - src/lib/dlv.ts - src/lib/encodings.ts - src/lib/http.ts - src/lib/is-plain-object.ts + - src/lib/logger.ts + - src/lib/matchers.ts - src/lib/primitives.ts - src/lib/retries.ts - src/lib/schemas.ts @@ -65,10 +146,13 @@ generatedFiles: - src/lib/security.ts - src/lib/url.ts - src/sdk/index.ts + - src/models/httpclienterrors.ts - src/models/sdkerror.ts - src/models/sdkvalidationerror.ts - src/types/blobs.ts + - src/types/constdatetime.ts - src/types/enums.ts + - src/types/fp.ts - src/types/index.ts - src/types/operations.ts - src/types/rfcdate.ts @@ -93,9 +177,14 @@ generatedFiles: - src/models/stopalltasksop.ts - src/models/starttaskop.ts - src/models/stoptaskop.ts + - src/models/getcompanionsdataop.ts + - src/models/getuserfriendsop.ts + - src/models/getgeodataop.ts - src/models/gethomedataop.ts + - src/models/getresourcesop.ts - src/models/getpinop.ts - - src/models/gettokenop.ts + - src/models/gettokenbypinidop.ts + - src/models/getuserdetailsop.ts - src/models/getglobalhubsop.ts - src/models/getlibraryhubsop.ts - src/models/performsearchop.ts @@ -137,6 +226,7 @@ generatedFiles: - src/models/getupdatestatusop.ts - src/models/checkforupdatesop.ts - src/models/applyupdatesop.ts + - src/models/postuserssignindataop.ts - src/models/getwatchlistop.ts - src/models/security.ts - src/models/index.ts @@ -240,24 +330,63 @@ generatedFiles: - docs/models/stoptaskerrors.md - docs/models/stoptaskresponsebody.md - docs/models/stoptaskresponse.md + - docs/models/getcompanionsdataerrors.md + - docs/models/getcompanionsdataresponsebody.md + - docs/models/responsebody.md + - docs/models/getcompanionsdataresponse.md + - docs/models/getuserfriendserrors.md + - docs/models/getuserfriendsresponsebody.md + - docs/models/sharedservers.md + - docs/models/sharedsources.md + - docs/models/status.md + - docs/models/friend.md + - docs/models/getuserfriendsresponse.md + - docs/models/getgeodataerrors.md + - docs/models/getgeodataresponsebody.md + - docs/models/getgeodatageodata.md + - docs/models/getgeodataresponse.md - docs/models/gethomedataerrors.md - docs/models/gethomedataplexresponsebody.md - docs/models/gethomedataresponsebody.md - docs/models/gethomedataresponse.md + - docs/models/getresourcesglobals.md + - docs/models/includehttps.md + - docs/models/includerelay.md + - docs/models/includeipv6.md + - docs/models/getresourcesrequest.md + - docs/models/getresourceserrors.md + - docs/models/getresourcesresponsebody.md + - docs/models/connections.md + - docs/models/plexdevice.md + - docs/models/getresourcesresponse.md - docs/models/getpinglobals.md - docs/models/getpinrequest.md - docs/models/getpinerrors.md - - docs/models/getpinplexresponsebody.md - - docs/models/location.md - docs/models/getpinresponsebody.md + - docs/models/geodata.md + - docs/models/getpinauthpincontainer.md - docs/models/getpinresponse.md - - docs/models/gettokenglobals.md - - docs/models/gettokenrequest.md - - docs/models/gettokenerrors.md - - docs/models/gettokenplexresponsebody.md - - docs/models/gettokenlocation.md - - docs/models/gettokenresponsebody.md - - docs/models/gettokenresponse.md + - docs/models/gettokenbypinidglobals.md + - docs/models/gettokenbypinidrequest.md + - docs/models/gettokenbypiniderrors.md + - docs/models/gettokenbypinidresponsebody.md + - docs/models/gettokenbypinidgeodata.md + - docs/models/gettokenbypinidauthpincontainer.md + - docs/models/gettokenbypinidresponse.md + - docs/models/getuserdetailserrors.md + - docs/models/getuserdetailsresponsebody.md + - docs/models/mailingliststatus.md + - docs/models/userprofile.md + - docs/models/getuserdetailsstatus.md + - docs/models/services.md + - docs/models/features.md + - docs/models/getuserdetailsplexstatus.md + - docs/models/subscription.md + - docs/models/getuserdetailsfeatures.md + - docs/models/getuserdetailsplexresponsestatus.md + - docs/models/getuserdetailssubscription.md + - docs/models/getuserdetailsuserplexaccount.md + - docs/models/getuserdetailsresponse.md - docs/models/onlytransient.md - docs/models/getglobalhubsrequest.md - docs/models/getglobalhubserrors.md @@ -326,7 +455,7 @@ generatedFiles: - docs/models/getrecentlyaddedresponse.md - docs/models/getlibrarieserrors.md - docs/models/getlibrarieslibraryresponsebody.md - - docs/models/getlibrarieslocation.md + - docs/models/location.md - docs/models/getlibrariesdirectory.md - docs/models/getlibrariesmediacontainer.md - docs/models/getlibrariesresponsebody.md @@ -408,7 +537,7 @@ generatedFiles: - docs/models/gettopwatchedcontentcountry.md - docs/models/gettopwatchedcontentguids.md - docs/models/gettopwatchedcontentrole.md - - docs/models/user.md + - docs/models/gettopwatchedcontentuser.md - docs/models/gettopwatchedcontentmetadata.md - docs/models/gettopwatchedcontentmediacontainer.md - docs/models/gettopwatchedcontentresponsebody.md @@ -579,6 +708,28 @@ generatedFiles: - docs/models/applyupdateserrors.md - docs/models/applyupdatesresponsebody.md - docs/models/applyupdatesresponse.md + - docs/models/postuserssignindataglobals.md + - docs/models/postuserssignindatarequestbody.md + - docs/models/postuserssignindatarequest.md + - docs/models/postuserssignindataerrors.md + - docs/models/postuserssignindataresponsebody.md + - docs/models/postuserssignindatamailingliststatus.md + - docs/models/postuserssignindatauserprofile.md + - docs/models/postuserssignindatastatus.md + - docs/models/postuserssignindataservices.md + - docs/models/postuserssignindatafeatures.md + - docs/models/postuserssignindatauserstatus.md + - docs/models/postuserssignindatasubscription.md + - docs/models/postuserssignindatauserfeatures.md + - docs/models/postuserssignindatauserresponsestatus.md + - docs/models/postuserssignindatausersubscription.md + - docs/models/postuserssignindatastate.md + - docs/models/internalpaymentmethod.md + - docs/models/billing.md + - docs/models/pastsubscription.md + - docs/models/trials.md + - docs/models/postuserssignindatauserplexaccount.md + - docs/models/postuserssignindataresponse.md - docs/models/pathparamfilter.md - docs/models/libtype.md - docs/models/includecollections.md @@ -592,6 +743,7 @@ generatedFiles: - docs/models/getwatchlistresponse.md - docs/models/security.md - docs/sdks/plexapi/README.md + - docs/lib/utils/retryconfig.md - docs/sdks/server/README.md - docs/sdks/media/README.md - docs/sdks/video/README.md @@ -607,9 +759,11 @@ generatedFiles: - docs/sdks/statistics/README.md - docs/sdks/sessions/README.md - docs/sdks/updater/README.md + - docs/sdks/user/README.md - docs/sdks/watchlist/README.md - USAGE.md - .gitattributes - src/hooks/hooks.ts - src/hooks/types.ts - src/hooks/index.ts + - CONTRIBUTING.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index bf2db6f7..c24abf48 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true typescript: - version: 0.18.2 + version: 0.19.0 additionalDependencies: dependencies: {} devDependencies: {} @@ -33,6 +33,7 @@ typescript: inputModelSuffix: input maxMethodParams: 4 methodArguments: require-security-and-request + moduleFormat: commonjs outputModelSuffix: output packageName: '@lukehagar/plexjs' responseFormat: envelope diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 4ba1e329..7f99ce36 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.323.0 +speakeasyVersion: 1.377.1 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:34d6078f698b0dd8314b634f063edbd2737ff9fa225839111b308effa0b3fc79 - sourceBlobDigest: sha256:1be3aa6d41b4e7a554218e6e10a32ece43156023f8a843127fa77e2e5c9a67b2 + sourceRevisionDigest: sha256:4e103669d4bcf7c698608fa37524f3d644510de45959c5437c21b60b2fb2dd9f + sourceBlobDigest: sha256:3cb937b6d66508640fa6080fa4c16ebef73a438fbb21a1f8833d6dd2e8fcd5ee tags: - latest - main @@ -11,10 +11,10 @@ targets: plexjs: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:34d6078f698b0dd8314b634f063edbd2737ff9fa225839111b308effa0b3fc79 - sourceBlobDigest: sha256:1be3aa6d41b4e7a554218e6e10a32ece43156023f8a843127fa77e2e5c9a67b2 + sourceRevisionDigest: sha256:4e103669d4bcf7c698608fa37524f3d644510de45959c5437c21b60b2fb2dd9f + sourceBlobDigest: sha256:3cb937b6d66508640fa6080fa4c16ebef73a438fbb21a1f8833d6dd2e8fcd5ee codeSamplesNamespace: code-samples-typescript-plexjs - codeSamplesRevisionDigest: sha256:b37dc035436959bd4af4ea4323a6fdf3461e482c3ec03538e949589a3e13c935 + codeSamplesRevisionDigest: sha256:439dcb28ca6dc855201641d70fc56ac3a6685187d824eb3077145b6a5be15b8b outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d585717f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/FUNCTIONS.md b/FUNCTIONS.md new file mode 100644 index 00000000..d3ded6dd --- /dev/null +++ b/FUNCTIONS.md @@ -0,0 +1,105 @@ +# Standalone Functions + +> [!NOTE] +> This section is useful if you are using a bundler and targetting browsers and +> runtimes where the size of an application affects performance and load times. + +Every method in this SDK is also available as a standalone function. This +alternative API is suitable when targetting the browser or serverless runtimes +and using a bundler to build your application since all unused functionality +will be tree-shaken away. This includes code for unused methods, Zod schemas, +encoding helpers and response handlers. The result is dramatically smaller +impact on the application's final bundle size which grows very slowly as you use +more and more functionality from this SDK. + +Calling methods through the main SDK class remains a valid and generally more +more ergonomic option. Standalone functions represent an optimisation for a +specific category of applications. + +## Example + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetServerCapabilities } from "@lukehagar/plexjs/funcs/serverGetServerCapabilities.js"; +import { SDKValidationError } from "@lukehagar/plexjs/models/sdkvalidationerror.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetServerCapabilities(plexAPI); + + switch (true) { + case res.ok: + // The success case will be handled outside of the switch block + break; + case res.error instanceof SDKValidationError: + // Pretty-print validation errors. + return console.log(res.error.pretty()); + case res.error instanceof Error: + return console.log(res.error); + default: + // TypeScript's type checking will fail on the following line if the above + // cases were not exhaustive. + res.error satisfies never; + throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error); + } + + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +## Result types + +Standalone functions differ from SDK methods in that they return a +`Result` type to capture _known errors_ and document them using +the type system. By avoiding throwing errors, application code maintains clear +control flow and error-handling become part of the regular flow of application +code. + +> We use the term "known errors" because standalone functions, and JavaScript +> code in general, can still throw unexpected errors such as `TypeError`s, +> `RangeError`s and `DOMException`s. Exhaustively catching all errors may be +> something this SDK addresses in the future. Nevertheless, there is still a lot +> of benefit from capturing most errors and turning them into values. + +The second reason for this style of programming is because these functions will +typically be used in front-end applications where exception throwing is +sometimes discouraged or considered unidiomatic. React and similar ecosystems +and libraries tend to promote this style of programming so that components +render useful content under all states (loading, success, error and so on). + +The general pattern when calling standalone functions looks like this: + +```typescript +import { Core } from ""; +import { fetchSomething } from "/funcs/fetchSomething.js"; + +const client = new Core(); + +async function run() { + const result = await fetchSomething(client, { id: "123" }); + if (!result.ok) { + // You can throw the error or handle it. It's your choice now. + throw result.error; + } + + console.log(result.value); +} + +run(); +``` + +Notably, `result.error` above will have an explicit type compared to a try-catch +variation where the error in the catch block can only be of type `unknown` (or +`any` depending on your TypeScript settings). \ No newline at end of file diff --git a/README.md b/README.md index 33c31fb4..92256b7e 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,14 @@ run(); ### [plex](docs/sdks/plex/README.md) +* [getCompanionsData](docs/sdks/plex/README.md#getcompanionsdata) - Get Companions Data +* [getUserFriends](docs/sdks/plex/README.md#getuserfriends) - Get list of friends of the user logged in +* [getGeoData](docs/sdks/plex/README.md#getgeodata) - Get Geo Data * [getHomeData](docs/sdks/plex/README.md#gethomedata) - Get Plex Home Data +* [getResources](docs/sdks/plex/README.md#getresources) - Get Resources * [getPin](docs/sdks/plex/README.md#getpin) - Get a Pin -* [getToken](docs/sdks/plex/README.md#gettoken) - Get Access Token +* [getTokenByPinId](docs/sdks/plex/README.md#gettokenbypinid) - Get Access Token by PinId +* [getUserDetails](docs/sdks/plex/README.md#getuserdetails) - Get UserData By Token ### [hubs](docs/sdks/hubs/README.md) @@ -175,6 +180,10 @@ run(); * [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates * [applyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates +### [user](docs/sdks/user/README.md) + +* [postUsersSigninData](docs/sdks/user/README.md#postuserssignindata) - Get User SignIn Data + ### [watchlist](docs/sdks/watchlist/README.md) * [getWatchlist](docs/sdks/watchlist/README.md#getwatchlist) - Get User Watchlist @@ -303,11 +312,12 @@ The server URL can also be overridden on a per-operation basis, provided a serve import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ + accessToken: "", xPlexClientIdentifier: "Postman", }); async function run() { - const result = await plexAPI.plex.getPin("Postman", false, "Postman", { + const result = await plexAPI.plex.getCompanionsData({ serverURL: "https://plex.tv/api/v2", }); @@ -407,37 +417,124 @@ run(); For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md). - -## Global Parameters + +## Standalone functions -A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed. +All the methods listed above are available as standalone functions. These +functions are ideal for use in applications running in the browser, serverless +runtimes or other environments where application bundle size is a primary +concern. When using a bundler to build your application, all unused +functionality will be either excluded from the final bundle or tree-shaken away. -For example, you can set `X-Plex-Client-Identifier` to `"Postman"` at SDK initialization and then you do not have to pass the same value on calls to operations like `getPin`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration. +To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). + +
+ +Available standalone functions + +- [activitiesCancelServerActivities](docs/sdks/activities/README.md#cancelserveractivities) +- [activitiesGetServerActivities](docs/sdks/activities/README.md#getserveractivities) +- [authenticationGetSourceConnectionInformation](docs/sdks/authentication/README.md#getsourceconnectioninformation) +- [authenticationGetTransientToken](docs/sdks/authentication/README.md#gettransienttoken) +- [butlerGetButlerTasks](docs/sdks/butler/README.md#getbutlertasks) +- [butlerStartAllTasks](docs/sdks/butler/README.md#startalltasks) +- [butlerStartTask](docs/sdks/butler/README.md#starttask) +- [butlerStopAllTasks](docs/sdks/butler/README.md#stopalltasks) +- [butlerStopTask](docs/sdks/butler/README.md#stoptask) +- [hubsGetGlobalHubs](docs/sdks/hubs/README.md#getglobalhubs) +- [hubsGetLibraryHubs](docs/sdks/hubs/README.md#getlibraryhubs) +- [libraryDeleteLibrary](docs/sdks/library/README.md#deletelibrary) +- [libraryGetFileHash](docs/sdks/library/README.md#getfilehash) +- [libraryGetLibraries](docs/sdks/library/README.md#getlibraries) +- [libraryGetLibraryItems](docs/sdks/library/README.md#getlibraryitems) +- [libraryGetLibrary](docs/sdks/library/README.md#getlibrary) +- [libraryGetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) +- [libraryGetMetadata](docs/sdks/library/README.md#getmetadata) +- [libraryGetOnDeck](docs/sdks/library/README.md#getondeck) +- [libraryGetRecentlyAdded](docs/sdks/library/README.md#getrecentlyadded) +- [libraryGetTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) +- [libraryRefreshLibrary](docs/sdks/library/README.md#refreshlibrary) +- [librarySearchLibrary](docs/sdks/library/README.md#searchlibrary) +- [logEnablePaperTrail](docs/sdks/log/README.md#enablepapertrail) +- [logLogLine](docs/sdks/log/README.md#logline) +- [logLogMultiLine](docs/sdks/log/README.md#logmultiline) +- [mediaMarkPlayed](docs/sdks/media/README.md#markplayed) +- [mediaMarkUnplayed](docs/sdks/media/README.md#markunplayed) +- [mediaUpdatePlayProgress](docs/sdks/media/README.md#updateplayprogress) +- [playlistsAddPlaylistContents](docs/sdks/playlists/README.md#addplaylistcontents) +- [playlistsClearPlaylistContents](docs/sdks/playlists/README.md#clearplaylistcontents) +- [playlistsCreatePlaylist](docs/sdks/playlists/README.md#createplaylist) +- [playlistsDeletePlaylist](docs/sdks/playlists/README.md#deleteplaylist) +- [playlistsGetPlaylistContents](docs/sdks/playlists/README.md#getplaylistcontents) +- [playlistsGetPlaylist](docs/sdks/playlists/README.md#getplaylist) +- [playlistsGetPlaylists](docs/sdks/playlists/README.md#getplaylists) +- [playlistsUpdatePlaylist](docs/sdks/playlists/README.md#updateplaylist) +- [playlistsUploadPlaylist](docs/sdks/playlists/README.md#uploadplaylist) +- [plexGetCompanionsData](docs/sdks/plex/README.md#getcompanionsdata) +- [plexGetGeoData](docs/sdks/plex/README.md#getgeodata) +- [plexGetHomeData](docs/sdks/plex/README.md#gethomedata) +- [plexGetPin](docs/sdks/plex/README.md#getpin) +- [plexGetResources](docs/sdks/plex/README.md#getresources) +- [plexGetTokenByPinId](docs/sdks/plex/README.md#gettokenbypinid) +- [plexGetUserDetails](docs/sdks/plex/README.md#getuserdetails) +- [plexGetUserFriends](docs/sdks/plex/README.md#getuserfriends) +- [searchGetSearchResults](docs/sdks/search/README.md#getsearchresults) +- [searchPerformSearch](docs/sdks/search/README.md#performsearch) +- [searchPerformVoiceSearch](docs/sdks/search/README.md#performvoicesearch) +- [serverGetAvailableClients](docs/sdks/server/README.md#getavailableclients) +- [serverGetDevices](docs/sdks/server/README.md#getdevices) +- [serverGetMyPlexAccount](docs/sdks/server/README.md#getmyplexaccount) +- [serverGetResizedPhoto](docs/sdks/server/README.md#getresizedphoto) +- [serverGetServerCapabilities](docs/sdks/server/README.md#getservercapabilities) +- [serverGetServerIdentity](docs/sdks/server/README.md#getserveridentity) +- [serverGetServerList](docs/sdks/server/README.md#getserverlist) +- [serverGetServerPreferences](docs/sdks/server/README.md#getserverpreferences) +- [sessionsGetSessionHistory](docs/sdks/sessions/README.md#getsessionhistory) +- [sessionsGetSessions](docs/sdks/sessions/README.md#getsessions) +- [sessionsGetTranscodeSessions](docs/sdks/sessions/README.md#gettranscodesessions) +- [sessionsStopTranscodeSession](docs/sdks/sessions/README.md#stoptranscodesession) +- [statisticsGetBandwidthStatistics](docs/sdks/statistics/README.md#getbandwidthstatistics) +- [statisticsGetResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) +- [statisticsGetStatistics](docs/sdks/statistics/README.md#getstatistics) +- [updaterApplyUpdates](docs/sdks/updater/README.md#applyupdates) +- [updaterCheckForUpdates](docs/sdks/updater/README.md#checkforupdates) +- [updaterGetUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) +- [userPostUsersSigninData](docs/sdks/user/README.md#postuserssignindata) +- [videoGetTimeline](docs/sdks/video/README.md#gettimeline) +- [videoStartUniversalTranscode](docs/sdks/video/README.md#startuniversaltranscode) +- [watchlistGetWatchlist](docs/sdks/watchlist/README.md#getwatchlist) -### Available Globals +
+ -The following global parameter is available. + +## Retries -| Name | Type | Required | Description | -| ---- | ---- |:--------:| ----------- | -| xPlexClientIdentifier | string | | The unique identifier for the client application -This is used to track the client application and its usage -(UUID, serial number, or other number unique per device) - | - - -### Example +Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. +To change the default retry strategy for a single API call, simply provide a retryConfig object to the call: ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ + accessToken: "", xPlexClientIdentifier: "Postman", }); async function run() { - const result = await plexAPI.plex.getPin("Postman", false, "Postman"); + const result = await plexAPI.server.getServerCapabilities({ + retries: { + strategy: "backoff", + backoff: { + initialInterval: 1, + maxInterval: 50, + exponent: 1.1, + maxElapsedTime: 100, + }, + retryConnectionErrors: false, + }, + }); // Handle the result console.log(result); @@ -446,7 +543,54 @@ async function run() { run(); ``` - + +If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization: +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + retryConfig: { + strategy: "backoff", + backoff: { + initialInterval: 1, + maxInterval: 50, + exponent: 1.1, + maxElapsedTime: 100, + }, + retryConnectionErrors: false, + }, + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.server.getServerCapabilities(); + + // Handle the result + console.log(result); +} + +run(); + +``` + + + +## Debugging + +You can setup your SDK to emit debug logs for SDK requests and responses. + +You can pass a logger that matches `console`'s interface as an SDK option. + +> [!WARNING] +> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production. + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const sdk = new PlexAPI({ debugLogger: console }); +``` + diff --git a/RELEASES.md b/RELEASES.md index 89e12369..401b56e1 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -928,4 +928,14 @@ Based on: ### Generated - [typescript v0.18.2] . ### Releases -- [NPM v0.18.2] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.18.2 - . \ No newline at end of file +- [NPM v0.18.2] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.18.2 - . + +## 2024-08-22 05:15:43 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.377.1 (2.404.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.19.0] . +### Releases +- [NPM v0.19.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.19.0 - . \ No newline at end of file diff --git a/RUNTIMES.md b/RUNTIMES.md index 71fa3dae..d08a0c07 100644 --- a/RUNTIMES.md +++ b/RUNTIMES.md @@ -3,7 +3,7 @@ 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` +* [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 diff --git a/codeSamples.yaml b/codeSamples.yaml index ae76bd58..976eb419 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,11 +3,32 @@ info: title: CodeSamples overlay for typescript target version: 0.0.0 actions: - - target: $["paths"]["/:/prefs"]["get"] + - target: $["paths"]["/library/sections/{sectionId}/search"]["get"] update: x-codeSamples: - lang: typescript - label: getServerPreferences + label: searchLibrary + source: |- + import { PlexAPI, Type } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.searchLibrary(933505, Type.Four); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists/{playlistID}"]["delete"] + update: + x-codeSamples: + - lang: typescript + label: deletePlaylist source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -17,18 +38,18 @@ actions: }); async function run() { - const result = await plexAPI.server.getServerPreferences(); + const result = await plexAPI.playlists.deletePlaylist(216.22); // Handle the result console.log(result) } run(); - - target: $["paths"]["/butler"]["post"] + - target: $["paths"]["/transcode/sessions"]["get"] update: x-codeSamples: - lang: typescript - label: startAllTasks + label: getTranscodeSessions source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -38,387 +59,7 @@ actions: }); async function run() { - const result = await plexAPI.butler.startAllTasks(); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists/upload"]["post"] - update: - x-codeSamples: - - lang: typescript - label: uploadPlaylist - source: |- - import { Force, PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.uploadPlaylist("/home/barkley/playlist.m3u", Force.Zero); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/activities/{activityUUID}"]["delete"] - update: - x-codeSamples: - - lang: typescript - label: cancelServerActivities - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.activities.cancelServerActivities("25b71ed5-0f9d-461c-baa7-d404e9e10d3e"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/hubs"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getGlobalHubs - source: |- - import { OnlyTransient, PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.hubs.getGlobalHubs(1262.49, OnlyTransient.One); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/butler"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getButlerTasks - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.butler.getButlerTasks(); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/butler/{taskName}"]["delete"] - update: - x-codeSamples: - - lang: typescript - label: stopTask - source: |- - import { PathParamTaskName, PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.butler.stopTask(PathParamTaskName.BackupDatabase); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/onDeck"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getOnDeck - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.library.getOnDeck(); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] - update: - x-codeSamples: - - lang: typescript - label: stopTranscodeSession - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.sessions.stopTranscodeSession("zz7llzqlx8w9vnrsbnwhbmep"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists/{playlistID}/items"]["put"] - update: - x-codeSamples: - - lang: typescript - label: addPlaylistContents - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.addPlaylistContents(8502.01, "server://12345/com.plexapp.plugins.library/library/metadata/1", 123); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/myplex/account"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getMyPlexAccount - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.server.getMyPlexAccount(); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/:/unscrobble"]["get"] - update: - x-codeSamples: - - lang: typescript - label: markUnplayed - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.media.markUnplayed(59398); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/log"]["post"] - update: - x-codeSamples: - - lang: typescript - label: logMultiLine - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.log.logMultiLine("level=4&message=Test%20message%201&source=postman - level=3&message=Test%20message%202&source=postman - level=1&message=Test%20message%203&source=postman"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists/{playlistID}"]["put"] - update: - x-codeSamples: - - lang: typescript - label: updatePlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.updatePlaylist(3915, "", ""); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/:/scrobble"]["get"] - update: - x-codeSamples: - - lang: typescript - label: markPlayed - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.media.markPlayed(59398); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/log"]["get"] - update: - x-codeSamples: - - lang: typescript - label: logLine - source: |- - import { Level, PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.log.logLine(Level.Three, "Test log message", "Postman"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists/{playlistID}/items"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getPlaylistContents - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.getPlaylistContents(5004.46, 9403.59); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] - update: - x-codeSamples: - - lang: typescript - label: clearPlaylistContents - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.clearPlaylistContents(1893.18); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/:/progress"]["post"] - update: - x-codeSamples: - - lang: typescript - label: updatePlayProgress - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.media.updatePlayProgress("", 90000, "played"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/status/sessions"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getSessions - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.sessions.getSessions(); + const result = await plexAPI.sessions.getTranscodeSessions(); // Handle the result console.log(result) @@ -445,6 +86,224 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getServerCapabilities + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.server.getServerCapabilities(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/butler"]["delete"] + update: + x-codeSamples: + - lang: typescript + label: stopAllTasks + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.butler.stopAllTasks(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/hubs"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getGlobalHubs + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.hubs.getGlobalHubs(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/sections/{sectionId}"]["delete"] + update: + x-codeSamples: + - lang: typescript + label: deleteLibrary + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.deleteLibrary(1000); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/user"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getUserDetails + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.plex.getUserDetails(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/recentlyAdded"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getRecentlyAdded + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.getRecentlyAdded(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists/{playlistID}"]["put"] + update: + x-codeSamples: + - lang: typescript + label: updatePlaylist + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.updatePlaylist(3915); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/security/token"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getTransientToken + source: |- + import { GetTransientTokenQueryParamType, PlexAPI, Scope } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.authentication.getTransientToken(GetTransientTokenQueryParamType.Delegation, Scope.All); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/clients"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getAvailableClients + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.server.getAvailableClients(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/photo/:/transcode"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getResizedPhoto + source: |- + import { MinSize, PlexAPI, Upscale } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.server.getResizedPhoto({ + width: 110, + height: 165, + opacity: 100, + blur: 20, + minSize: MinSize.One, + upscale: Upscale.Zero, + url: "/library/metadata/49564/thumb/1654258204", + }); + + // Handle the result + console.log(result) + } + run(); - target: $["paths"]["/:/timeline"]["get"] update: @@ -478,11 +337,11 @@ actions: } run(); - - target: $["paths"]["/library/sections/{sectionId}"]["delete"] + - target: $["paths"]["/friends"]["get"] update: x-codeSamples: - lang: typescript - label: deleteLibrary + label: getUserFriends source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -492,224 +351,29 @@ actions: }); async function run() { - const result = await plexAPI.library.deleteLibrary(1000); + const result = await plexAPI.plex.getUserFriends(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/library/sections/{sectionId}/search"]["get"] + - target: $["paths"]["/users/signin"]["post"] update: x-codeSamples: - lang: typescript - label: searchLibrary - source: |- - import { PlexAPI, Type } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.library.searchLibrary(933505, Type.Four); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/statistics/bandwidth"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getBandwidthStatistics + label: data source: |- import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ - accessToken: "", xPlexClientIdentifier: "Postman", }); async function run() { - const result = await plexAPI.statistics.getBandwidthStatistics(4); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getPlaylists - source: |- - import { PlaylistType, PlexAPI, QueryParamSmart } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.getPlaylists(PlaylistType.Audio, QueryParamSmart.Zero); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/playlists/{playlistID}"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getPlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.playlists.getPlaylist(4109.48); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/identity"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getServerIdentity - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.server.getServerIdentity(); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/sections/{sectionId}"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getLibrary - source: |- - import { IncludeDetails, PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.library.getLibrary(1000, IncludeDetails.Zero); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/sections/{sectionId}/{tag}"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getLibraryItems - source: |- - import { PlexAPI, Tag } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.library.getLibraryItems("", Tag.Genre, 1); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] - update: - x-codeSamples: - - lang: typescript - label: refreshLibrary - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.library.refreshLibrary(934.16); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/status/sessions/history/all"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getSessionHistory - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.sessions.getSessionHistory("", 1, {}, 12); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/photo/:/transcode"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getResizedPhoto - source: |- - import { MinSize, PlexAPI, Upscale } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.server.getResizedPhoto({ - width: 110, - height: 165, - opacity: 100, - blur: 20, - minSize: MinSize.One, - upscale: Upscale.Zero, - url: "/library/metadata/49564/thumb/1654258204", + const result = await plexAPI.user.postUsersSigninData("Postman", { + login: "username@email.com", + password: "password123", }); // Handle the result @@ -717,11 +381,11 @@ actions: } run(); - - target: $["paths"]["/library/recentlyAdded"]["get"] + - target: $["paths"]["/home"]["get"] update: x-codeSamples: - lang: typescript - label: getRecentlyAdded + label: getHomeData source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -731,18 +395,18 @@ actions: }); async function run() { - const result = await plexAPI.library.getRecentlyAdded(); + const result = await plexAPI.plex.getHomeData(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/security/resources"]["get"] + - target: $["paths"]["/library/hashes"]["get"] update: x-codeSamples: - lang: typescript - label: getSourceConnectionInformation + label: getFileHash source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -752,20 +416,20 @@ actions: }); async function run() { - const result = await plexAPI.authentication.getSourceConnectionInformation("server://client-identifier"); + const result = await plexAPI.library.getFileHash("file://C:\Image.png&type=13"); // Handle the result console.log(result) } run(); - - target: $["paths"]["/library/sections/watchlist/{filter}"]["get"] + - target: $["paths"]["/log"]["get"] update: x-codeSamples: - lang: typescript - label: getWatchlist + label: logLine source: |- - import { PathParamFilter, PlexAPI } from "@lukehagar/plexjs"; + import { Level, PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", @@ -773,21 +437,18 @@ actions: }); async function run() { - const result = await plexAPI.watchlist.getWatchlist({ - filter: PathParamFilter.Released, - xPlexToken: "", - }); + const result = await plexAPI.log.logLine(Level.Three, "Test log message", "Postman"); // Handle the result console.log(result) } run(); - - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] + - target: $["paths"]["/:/prefs"]["get"] update: x-codeSamples: - lang: typescript - label: getMetadataChildren + label: getServerPreferences source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -797,70 +458,7 @@ actions: }); async function run() { - const result = await plexAPI.library.getMetadataChildren(1539.14, ""); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/log/networked"]["get"] - update: - x-codeSamples: - - lang: typescript - label: enablePaperTrail - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.log.enablePaperTrail(); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/security/token"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getTransientToken - source: |- - import { GetTransientTokenQueryParamType, PlexAPI, Scope } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.authentication.getTransientToken(GetTransientTokenQueryParamType.Delegation, Scope.All); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getServerCapabilities - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.server.getServerCapabilities(); + const result = await plexAPI.server.getServerPreferences(); // Handle the result console.log(result) @@ -888,31 +486,11 @@ actions: } run(); - - target: $["paths"]["/pins/{pinID}"]["get"] + - target: $["paths"]["/butler"]["post"] update: x-codeSamples: - lang: typescript - label: getToken - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.plex.getToken("", "Postman"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/hashes"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getFileHash + label: startAllTasks source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -922,18 +500,18 @@ actions: }); async function run() { - const result = await plexAPI.library.getFileHash("file://C:\Image.png&type=13", 4462.17); + const result = await plexAPI.butler.startAllTasks(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/butler"]["delete"] + - target: $["paths"]["/identity"]["get"] update: x-codeSamples: - lang: typescript - label: stopAllTasks + label: getServerIdentity source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -943,38 +521,18 @@ actions: }); async function run() { - const result = await plexAPI.butler.stopAllTasks(); + const result = await plexAPI.server.getServerIdentity(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/pins"]["post"] + - target: $["paths"]["/:/scrobble"]["get"] update: x-codeSamples: - lang: typescript - label: getPin - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.plex.getPin("Postman", false, "Postman"); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/all/top"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getTopWatchedContent + label: markPlayed source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -984,18 +542,18 @@ actions: }); async function run() { - const result = await plexAPI.library.getTopWatchedContent(505531, 1); + const result = await plexAPI.media.markPlayed(59398); // Handle the result console.log(result) } run(); - - target: $["paths"]["/playlists/{playlistID}"]["delete"] + - target: $["paths"]["/library/sections/{sectionId}"]["get"] update: x-codeSamples: - lang: typescript - label: deletePlaylist + label: getLibrary source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1005,18 +563,18 @@ actions: }); async function run() { - const result = await plexAPI.playlists.deletePlaylist(216.22); + const result = await plexAPI.library.getLibrary(1000); // Handle the result console.log(result) } run(); - - target: $["paths"]["/hubs/search/voice"]["get"] + - target: $["paths"]["/hubs/search"]["get"] update: x-codeSamples: - lang: typescript - label: performVoiceSearch + label: performSearch source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1026,7 +584,112 @@ actions: }); async function run() { - const result = await plexAPI.search.performVoiceSearch("dead+poop", 4094.8, 5); + const result = await plexAPI.search.performSearch("dylan", 5); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/security/resources"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getSourceConnectionInformation + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.authentication.getSourceConnectionInformation("server://client-identifier"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/devices"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getDevices + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.server.getDevices(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/myplex/account"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getMyPlexAccount + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.server.getMyPlexAccount(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/butler/{taskName}"]["delete"] + update: + x-codeSamples: + - lang: typescript + label: stopTask + source: |- + import { PathParamTaskName, PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.butler.stopTask(PathParamTaskName.BackupDatabase); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists/{playlistID}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getPlaylist + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.getPlaylist(4109.48); // Handle the result console.log(result) @@ -1053,6 +716,131 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/playlists/{playlistID}/items"]["put"] + update: + x-codeSamples: + - lang: typescript + label: addPlaylistContents + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.addPlaylistContents(8502.01, "server://12345/com.plexapp.plugins.library/library/metadata/1", 123); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists/upload"]["post"] + update: + x-codeSamples: + - lang: typescript + label: uploadPlaylist + source: |- + import { Force, PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.uploadPlaylist("/home/barkley/playlist.m3u", Force.Zero); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/:/unscrobble"]["get"] + update: + x-codeSamples: + - lang: typescript + label: markUnplayed + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.media.markUnplayed(59398); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/pins/{pinID}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getTokenByPinId + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.plex.getTokenByPinId(408895, "Postman"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getLibraryHubs + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.hubs.getLibraryHubs(6728.76); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] + update: + x-codeSamples: + - lang: typescript + label: refreshLibrary + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.refreshLibrary(934.16); + + // Handle the result + console.log(result) + } + run(); - target: $["paths"]["/playlists"]["post"] update: @@ -1080,11 +868,11 @@ actions: } run(); - - target: $["paths"]["/updater/status"]["get"] + - target: $["paths"]["/statistics/media"]["get"] update: x-codeSamples: - lang: typescript - label: getUpdateStatus + label: getStatistics source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1094,18 +882,18 @@ actions: }); async function run() { - const result = await plexAPI.updater.getUpdateStatus(); + const result = await plexAPI.statistics.getStatistics(4); // Handle the result console.log(result) } run(); - - target: $["paths"]["/activities"]["get"] + - target: $["paths"]["/activities/{activityUUID}"]["delete"] update: x-codeSamples: - lang: typescript - label: getServerActivities + label: cancelServerActivities source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1115,39 +903,18 @@ actions: }); async function run() { - const result = await plexAPI.activities.getServerActivities(); + const result = await plexAPI.activities.cancelServerActivities("25b71ed5-0f9d-461c-baa7-d404e9e10d3e"); // Handle the result console.log(result) } run(); - - target: $["paths"]["/butler/{taskName}"]["post"] + - target: $["paths"]["/hubs/search/voice"]["get"] update: x-codeSamples: - lang: typescript - label: startTask - source: |- - import { PlexAPI, TaskName } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.butler.startTask(TaskName.CleanOldBundles); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/home"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getHomeData + label: performVoiceSearch source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1157,18 +924,18 @@ actions: }); async function run() { - const result = await plexAPI.plex.getHomeData(); + const result = await plexAPI.search.performVoiceSearch("dead+poop", 5); // Handle the result console.log(result) } run(); - - target: $["paths"]["/hubs/search"]["get"] + - target: $["paths"]["/library/sections"]["get"] update: x-codeSamples: - lang: typescript - label: performSearch + label: getLibraries source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1178,7 +945,114 @@ actions: }); async function run() { - const result = await plexAPI.search.performSearch("dylan", 1516.53, 5); + const result = await plexAPI.library.getLibraries(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/sections/{sectionId}/{tag}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getLibraryItems + source: |- + import { PlexAPI, Tag } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.getLibraryItems("", Tag.Genre, 1); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/onDeck"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getOnDeck + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.getOnDeck(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists/{playlistID}/items"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getPlaylistContents + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.getPlaylistContents(5004.46, 9403.59); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/log"]["post"] + update: + x-codeSamples: + - lang: typescript + label: logMultiLine + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.log.logMultiLine("level=4&message=Test%20message%201&source=postman + level=3&message=Test%20message%202&source=postman + level=1&message=Test%20message%203&source=postman"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getPlaylists + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.getPlaylists(); // Handle the result console.log(result) @@ -1205,6 +1079,237 @@ actions: console.log(result) } + run(); + - target: $["paths"]["/:/progress"]["post"] + update: + x-codeSamples: + - lang: typescript + label: updatePlayProgress + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.media.updatePlayProgress("", 90000, "played"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/companions"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getCompanionsData + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.plex.getCompanionsData(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/geoip"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getGeoData + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.plex.getGeoData(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getMetadata + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.getMetadata(17); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/sections/watchlist/{filter}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getWatchlist + source: |- + import { PathParamFilter, PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.watchlist.getWatchlist({ + filter: PathParamFilter.Released, + xPlexToken: "", + }); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/resources"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getResources + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.plex.getResources("Postman"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/pins"]["post"] + update: + x-codeSamples: + - lang: typescript + label: getPin + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.plex.getPin("Postman", "Postman"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] + update: + x-codeSamples: + - lang: typescript + label: clearPlaylistContents + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.playlists.clearPlaylistContents(1893.18); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] + update: + x-codeSamples: + - lang: typescript + label: stopTranscodeSession + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.sessions.stopTranscodeSession("zz7llzqlx8w9vnrsbnwhbmep"); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/status/sessions"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getSessions + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.sessions.getSessions(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/updater/status"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getUpdateStatus + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.updater.getUpdateStatus(); + + // Handle the result + console.log(result) + } + run(); - target: $["paths"]["/video/:/transcode/universal/start.mpd"]["get"] update: @@ -1244,13 +1349,13 @@ actions: } run(); - - target: $["paths"]["/clients"]["get"] + - target: $["paths"]["/butler/{taskName}"]["post"] update: x-codeSamples: - lang: typescript - label: getAvailableClients + label: startTask source: |- - import { PlexAPI } from "@lukehagar/plexjs"; + import { PlexAPI, TaskName } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", @@ -1258,18 +1363,18 @@ actions: }); async function run() { - const result = await plexAPI.server.getAvailableClients(); + const result = await plexAPI.butler.startTask(TaskName.CleanOldBundles); // Handle the result console.log(result) } run(); - - target: $["paths"]["/devices"]["get"] + - target: $["paths"]["/log/networked"]["get"] update: x-codeSamples: - lang: typescript - label: getDevices + label: enablePaperTrail source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1279,7 +1384,7 @@ actions: }); async function run() { - const result = await plexAPI.server.getDevices(); + const result = await plexAPI.log.enablePaperTrail(); // Handle the result console.log(result) @@ -1307,11 +1412,11 @@ actions: } run(); - - target: $["paths"]["/transcode/sessions"]["get"] + - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] update: x-codeSamples: - lang: typescript - label: getTranscodeSessions + label: getMetadataChildren source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1321,39 +1426,18 @@ actions: }); async function run() { - const result = await plexAPI.sessions.getTranscodeSessions(); + const result = await plexAPI.library.getMetadataChildren(1539.14, "Stream"); // Handle the result console.log(result) } run(); - - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] + - target: $["paths"]["/status/sessions/history/all"]["get"] update: x-codeSamples: - lang: typescript - label: getLibraryHubs - source: |- - import { PlexAPI, QueryParamOnlyTransient } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - xPlexClientIdentifier: "Postman", - }); - - async function run() { - const result = await plexAPI.hubs.getLibraryHubs(6728.76, 9010.22, QueryParamOnlyTransient.Zero); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/library/sections"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getLibraries + label: getSessionHistory source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1363,18 +1447,18 @@ actions: }); async function run() { - const result = await plexAPI.library.getLibraries(); + const result = await plexAPI.sessions.getSessionHistory("viewedAt:desc", 1, {}, 12); // Handle the result console.log(result) } run(); - - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] + - target: $["paths"]["/activities"]["get"] update: x-codeSamples: - lang: typescript - label: getMetadata + label: getServerActivities source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1384,18 +1468,18 @@ actions: }); async function run() { - const result = await plexAPI.library.getMetadata(8382.31); + const result = await plexAPI.activities.getServerActivities(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/statistics/media"]["get"] + - target: $["paths"]["/butler"]["get"] update: x-codeSamples: - lang: typescript - label: getStatistics + label: getButlerTasks source: |- import { PlexAPI } from "@lukehagar/plexjs"; @@ -1405,7 +1489,49 @@ actions: }); async function run() { - const result = await plexAPI.statistics.getStatistics(4); + const result = await plexAPI.butler.getButlerTasks(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/library/all/top"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getTopWatchedContent + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.library.getTopWatchedContent(1, 1); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/statistics/bandwidth"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getBandwidthStatistics + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", + }); + + async function run() { + const result = await plexAPI.statistics.getBandwidthStatistics(4); // Handle the result console.log(result) diff --git a/docs/lib/utils/retryconfig.md b/docs/lib/utils/retryconfig.md new file mode 100644 index 00000000..08f95f45 --- /dev/null +++ b/docs/lib/utils/retryconfig.md @@ -0,0 +1,24 @@ +# RetryConfig + +Allows customizing the default retry configuration. It is only permitted in methods that accept retry policies. + +## Fields + +| Name | Type | Description | Example | +| ------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------ | ----------- | +| `strategy` | `"backoff" | "none"` | The retry strategy to use. | `"backoff"` | +| `backoff` | [BackoffStrategy](#backoffstrategy) | When strategy is "backoff", this configurates for the backoff parameters. | | +| `retryConnectionErrors` | `*boolean*` | When strategy is "backoff", this determines whether or not to retry on connection errors. | `true` | + +## BackoffStrategy + +The backoff strategy allows retrying a request with an exponential backoff between each retry. + +### Fields + +| Name | Type | Description | Example | +| ------------------ | ------------ | ----------------------------------------- | -------- | +| `initialInterval` | `*number*` | The initial interval in milliseconds. | `500` | +| `maxInterval` | `*number*` | The maximum interval in milliseconds. | `60000` | +| `exponent` | `*number*` | The exponent to use for the backoff. | `1.5` | +| `maxElapsedTime` | `*number*` | The maximum elapsed time in milliseconds. | `300000` | \ No newline at end of file diff --git a/docs/models/account.md b/docs/models/account.md index e3e75214..b6d0621b 100644 --- a/docs/models/account.md +++ b/docs/models/account.md @@ -1,5 +1,21 @@ # Account +## Example Usage + +```typescript +import { Account } from "@lukehagar/plexjs"; + +let value: Account = { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", +}; +``` ## Fields diff --git a/docs/models/activity.md b/docs/models/activity.md index 0a359762..db9d131f 100644 --- a/docs/models/activity.md +++ b/docs/models/activity.md @@ -1,5 +1,12 @@ # Activity +## Example Usage + +```typescript +import { Activity } from "@lukehagar/plexjs"; + +let value: Activity = {}; +``` ## Fields diff --git a/docs/models/addplaylistcontentserrors.md b/docs/models/addplaylistcontentserrors.md index 6a9cd1d9..485cd86e 100644 --- a/docs/models/addplaylistcontentserrors.md +++ b/docs/models/addplaylistcontentserrors.md @@ -1,5 +1,16 @@ # AddPlaylistContentsErrors +## Example Usage + +```typescript +import { AddPlaylistContentsErrors } from "@lukehagar/plexjs"; + +let value: AddPlaylistContentsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/addplaylistcontentsmediacontainer.md b/docs/models/addplaylistcontentsmediacontainer.md index a1fbb91a..f478da5a 100644 --- a/docs/models/addplaylistcontentsmediacontainer.md +++ b/docs/models/addplaylistcontentsmediacontainer.md @@ -1,5 +1,33 @@ # AddPlaylistContentsMediaContainer +## Example Usage + +```typescript +import { AddPlaylistContentsMediaContainer } from "@lukehagar/plexjs"; + +let value: AddPlaylistContentsMediaContainer = { + size: 1, + leafCountAdded: 1, + leafCountRequested: 1, + metadata: [ + { + ratingKey: "94", + key: "/playlists/94/items", + guid: "com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2", + type: "playlist", + title: "A great playlist", + summary: "One of my great playlists", + smart: false, + playlistType: "video", + composite: "/playlists/94/composite/1705800070", + duration: 423000, + leafCount: 3, + addedAt: 1705716458, + updatedAt: 1705800070, + }, + ], +}; +``` ## Fields diff --git a/docs/models/addplaylistcontentsmetadata.md b/docs/models/addplaylistcontentsmetadata.md index c90820e5..ef1a5b5a 100644 --- a/docs/models/addplaylistcontentsmetadata.md +++ b/docs/models/addplaylistcontentsmetadata.md @@ -1,5 +1,26 @@ # AddPlaylistContentsMetadata +## Example Usage + +```typescript +import { AddPlaylistContentsMetadata } from "@lukehagar/plexjs"; + +let value: AddPlaylistContentsMetadata = { + ratingKey: "94", + key: "/playlists/94/items", + guid: "com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2", + type: "playlist", + title: "A great playlist", + summary: "One of my great playlists", + smart: false, + playlistType: "video", + composite: "/playlists/94/composite/1705800070", + duration: 423000, + leafCount: 3, + addedAt: 1705716458, + updatedAt: 1705800070, +}; +``` ## Fields diff --git a/docs/models/addplaylistcontentsplaylistsresponsebody.md b/docs/models/addplaylistcontentsplaylistsresponsebody.md index 64c21d13..dff430d0 100644 --- a/docs/models/addplaylistcontentsplaylistsresponsebody.md +++ b/docs/models/addplaylistcontentsplaylistsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { AddPlaylistContentsPlaylistsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/addplaylistcontentsrequest.md b/docs/models/addplaylistcontentsrequest.md index 1d6896d7..34f3d8fd 100644 --- a/docs/models/addplaylistcontentsrequest.md +++ b/docs/models/addplaylistcontentsrequest.md @@ -1,5 +1,16 @@ # AddPlaylistContentsRequest +## Example Usage + +```typescript +import { AddPlaylistContentsRequest } from "@lukehagar/plexjs"; + +let value: AddPlaylistContentsRequest = { + playlistID: 6350.59, + uri: "server://12345/com.plexapp.plugins.library/library/metadata/1", + playQueueID: 123, +}; +``` ## Fields diff --git a/docs/models/addplaylistcontentsresponse.md b/docs/models/addplaylistcontentsresponse.md index 4fe5c906..6de86176 100644 --- a/docs/models/addplaylistcontentsresponse.md +++ b/docs/models/addplaylistcontentsresponse.md @@ -1,5 +1,42 @@ # AddPlaylistContentsResponse +## Example Usage + +```typescript +import { AddPlaylistContentsResponse } from "@lukehagar/plexjs"; + +let value: AddPlaylistContentsResponse = { + contentType: "", + statusCode: 161309, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + leafCountAdded: 1, + leafCountRequested: 1, + metadata: [ + { + ratingKey: "94", + key: "/playlists/94/items", + guid: "com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2", + type: "playlist", + title: "A great playlist", + summary: "One of my great playlists", + smart: false, + playlistType: "video", + composite: "/playlists/94/composite/1705800070", + duration: 423000, + leafCount: 3, + addedAt: 1705716458, + updatedAt: 1705800070, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/addplaylistcontentsresponsebody.md b/docs/models/addplaylistcontentsresponsebody.md index 72ff5543..c9a9e016 100644 --- a/docs/models/addplaylistcontentsresponsebody.md +++ b/docs/models/addplaylistcontentsresponsebody.md @@ -2,6 +2,36 @@ Playlist Updated +## Example Usage + +```typescript +import { AddPlaylistContentsResponseBody } from "@lukehagar/plexjs"; + +let value: AddPlaylistContentsResponseBody = { + mediaContainer: { + size: 1, + leafCountAdded: 1, + leafCountRequested: 1, + metadata: [ + { + ratingKey: "94", + key: "/playlists/94/items", + guid: "com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2", + type: "playlist", + title: "A great playlist", + summary: "One of my great playlists", + smart: false, + playlistType: "video", + composite: "/playlists/94/composite/1705800070", + duration: 423000, + leafCount: 3, + addedAt: 1705716458, + updatedAt: 1705800070, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/applyupdateserrors.md b/docs/models/applyupdateserrors.md index ff74a75d..29a0949d 100644 --- a/docs/models/applyupdateserrors.md +++ b/docs/models/applyupdateserrors.md @@ -1,5 +1,16 @@ # ApplyUpdatesErrors +## Example Usage + +```typescript +import { ApplyUpdatesErrors } from "@lukehagar/plexjs"; + +let value: ApplyUpdatesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/applyupdatesrequest.md b/docs/models/applyupdatesrequest.md index ae2b2eb6..8142dd9e 100644 --- a/docs/models/applyupdatesrequest.md +++ b/docs/models/applyupdatesrequest.md @@ -1,5 +1,15 @@ # ApplyUpdatesRequest +## Example Usage + +```typescript +import { ApplyUpdatesRequest, Skip, Tonight } from "@lukehagar/plexjs"; + +let value: ApplyUpdatesRequest = { + tonight: Tonight.One, + skip: Skip.One, +}; +``` ## Fields diff --git a/docs/models/applyupdatesresponse.md b/docs/models/applyupdatesresponse.md index 767b1dc9..a9a108f1 100644 --- a/docs/models/applyupdatesresponse.md +++ b/docs/models/applyupdatesresponse.md @@ -1,5 +1,18 @@ # ApplyUpdatesResponse +## Example Usage + +```typescript +import { ApplyUpdatesResponse } from "@lukehagar/plexjs"; + +let value: ApplyUpdatesResponse = { + contentType: "", + statusCode: 138183, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/applyupdatesresponsebody.md b/docs/models/applyupdatesresponsebody.md index ca198f4b..cda0b512 100644 --- a/docs/models/applyupdatesresponsebody.md +++ b/docs/models/applyupdatesresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { ApplyUpdatesResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/billing.md b/docs/models/billing.md new file mode 100644 index 00000000..8511239d --- /dev/null +++ b/docs/models/billing.md @@ -0,0 +1,19 @@ +# Billing + +## Example Usage + +```typescript +import { Billing } from "@lukehagar/plexjs"; + +let value: Billing = { + internalPaymentMethod: {}, + paymentMethodId: 368725, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `internalPaymentMethod` | [models.InternalPaymentMethod](../models/internalpaymentmethod.md) | :heavy_check_mark: | N/A | +| `paymentMethodId` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/butlertask.md b/docs/models/butlertask.md index 2148949a..e61a7085 100644 --- a/docs/models/butlertask.md +++ b/docs/models/butlertask.md @@ -1,5 +1,17 @@ # ButlerTask +## Example Usage + +```typescript +import { ButlerTask } from "@lukehagar/plexjs"; + +let value: ButlerTask = { + name: "BackupDatabase", + interval: 3, + title: "Backup Database", + description: "Create a backup copy of the server's database in the configured backup directory", +}; +``` ## Fields diff --git a/docs/models/butlertasks.md b/docs/models/butlertasks.md index aea5c3e5..02922b91 100644 --- a/docs/models/butlertasks.md +++ b/docs/models/butlertasks.md @@ -1,5 +1,22 @@ # ButlerTasks +## Example Usage + +```typescript +import { ButlerTasks } from "@lukehagar/plexjs"; + +let value: ButlerTasks = { + butlerTask: [ + { + name: "BackupDatabase", + interval: 3, + title: "Backup Database", + description: + "Create a backup copy of the server's database in the configured backup directory", + }, + ], +}; +``` ## Fields diff --git a/docs/models/cancelserveractivitieserrors.md b/docs/models/cancelserveractivitieserrors.md index bea7f9a5..ce3833e9 100644 --- a/docs/models/cancelserveractivitieserrors.md +++ b/docs/models/cancelserveractivitieserrors.md @@ -1,5 +1,16 @@ # CancelServerActivitiesErrors +## Example Usage + +```typescript +import { CancelServerActivitiesErrors } from "@lukehagar/plexjs"; + +let value: CancelServerActivitiesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/cancelserveractivitiesrequest.md b/docs/models/cancelserveractivitiesrequest.md index df45e5a6..ab0e1c29 100644 --- a/docs/models/cancelserveractivitiesrequest.md +++ b/docs/models/cancelserveractivitiesrequest.md @@ -1,5 +1,14 @@ # CancelServerActivitiesRequest +## Example Usage + +```typescript +import { CancelServerActivitiesRequest } from "@lukehagar/plexjs"; + +let value: CancelServerActivitiesRequest = { + activityUUID: "25b71ed5-0f9d-461c-baa7-d404e9e10d3e", +}; +``` ## Fields diff --git a/docs/models/cancelserveractivitiesresponse.md b/docs/models/cancelserveractivitiesresponse.md index 0342fe53..d50e3c4f 100644 --- a/docs/models/cancelserveractivitiesresponse.md +++ b/docs/models/cancelserveractivitiesresponse.md @@ -1,5 +1,18 @@ # CancelServerActivitiesResponse +## Example Usage + +```typescript +import { CancelServerActivitiesResponse } from "@lukehagar/plexjs"; + +let value: CancelServerActivitiesResponse = { + contentType: "", + statusCode: 477665, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/cancelserveractivitiesresponsebody.md b/docs/models/cancelserveractivitiesresponsebody.md index 55656b2d..ae38befe 100644 --- a/docs/models/cancelserveractivitiesresponsebody.md +++ b/docs/models/cancelserveractivitiesresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { CancelServerActivitiesResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/checkforupdateserrors.md b/docs/models/checkforupdateserrors.md index 6f2cea9b..cca031f9 100644 --- a/docs/models/checkforupdateserrors.md +++ b/docs/models/checkforupdateserrors.md @@ -1,5 +1,16 @@ # CheckForUpdatesErrors +## Example Usage + +```typescript +import { CheckForUpdatesErrors } from "@lukehagar/plexjs"; + +let value: CheckForUpdatesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/checkforupdatesrequest.md b/docs/models/checkforupdatesrequest.md index 128421ad..b9a5571c 100644 --- a/docs/models/checkforupdatesrequest.md +++ b/docs/models/checkforupdatesrequest.md @@ -1,5 +1,14 @@ # CheckForUpdatesRequest +## Example Usage + +```typescript +import { CheckForUpdatesRequest, Download } from "@lukehagar/plexjs"; + +let value: CheckForUpdatesRequest = { + download: Download.One, +}; +``` ## Fields diff --git a/docs/models/checkforupdatesresponse.md b/docs/models/checkforupdatesresponse.md index 99819de9..9cd21e0f 100644 --- a/docs/models/checkforupdatesresponse.md +++ b/docs/models/checkforupdatesresponse.md @@ -1,5 +1,18 @@ # CheckForUpdatesResponse +## Example Usage + +```typescript +import { CheckForUpdatesResponse } from "@lukehagar/plexjs"; + +let value: CheckForUpdatesResponse = { + contentType: "", + statusCode: 317202, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/checkforupdatesresponsebody.md b/docs/models/checkforupdatesresponsebody.md index 587e9498..0edd4c6f 100644 --- a/docs/models/checkforupdatesresponsebody.md +++ b/docs/models/checkforupdatesresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { CheckForUpdatesResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/clearplaylistcontentserrors.md b/docs/models/clearplaylistcontentserrors.md index 5cec3cfb..9e50cdfd 100644 --- a/docs/models/clearplaylistcontentserrors.md +++ b/docs/models/clearplaylistcontentserrors.md @@ -1,5 +1,16 @@ # ClearPlaylistContentsErrors +## Example Usage + +```typescript +import { ClearPlaylistContentsErrors } from "@lukehagar/plexjs"; + +let value: ClearPlaylistContentsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/clearplaylistcontentsrequest.md b/docs/models/clearplaylistcontentsrequest.md index 874331ec..bd9b8b2d 100644 --- a/docs/models/clearplaylistcontentsrequest.md +++ b/docs/models/clearplaylistcontentsrequest.md @@ -1,5 +1,14 @@ # ClearPlaylistContentsRequest +## Example Usage + +```typescript +import { ClearPlaylistContentsRequest } from "@lukehagar/plexjs"; + +let value: ClearPlaylistContentsRequest = { + playlistID: 6527.9, +}; +``` ## Fields diff --git a/docs/models/clearplaylistcontentsresponse.md b/docs/models/clearplaylistcontentsresponse.md index dbc3597f..806ab215 100644 --- a/docs/models/clearplaylistcontentsresponse.md +++ b/docs/models/clearplaylistcontentsresponse.md @@ -1,5 +1,18 @@ # ClearPlaylistContentsResponse +## Example Usage + +```typescript +import { ClearPlaylistContentsResponse } from "@lukehagar/plexjs"; + +let value: ClearPlaylistContentsResponse = { + contentType: "", + statusCode: 208876, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/clearplaylistcontentsresponsebody.md b/docs/models/clearplaylistcontentsresponsebody.md index 80dbea35..420c980a 100644 --- a/docs/models/clearplaylistcontentsresponsebody.md +++ b/docs/models/clearplaylistcontentsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { ClearPlaylistContentsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/connections.md b/docs/models/connections.md new file mode 100644 index 00000000..1e54630f --- /dev/null +++ b/docs/models/connections.md @@ -0,0 +1,21 @@ +# Connections + +## Example Usage + +```typescript +import { Connections } from "@lukehagar/plexjs"; + +let value: Connections = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `protocol` | *string* | :heavy_minus_sign: | N/A | +| `address` | *string* | :heavy_minus_sign: | N/A | +| `port` | *number* | :heavy_minus_sign: | N/A | +| `uri` | *string* | :heavy_minus_sign: | N/A | +| `local` | *boolean* | :heavy_minus_sign: | N/A | +| `relay` | *boolean* | :heavy_minus_sign: | N/A | +| `iPv6` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/context.md b/docs/models/context.md index a83fd168..c6aba5bf 100644 --- a/docs/models/context.md +++ b/docs/models/context.md @@ -1,5 +1,12 @@ # Context +## Example Usage + +```typescript +import { Context } from "@lukehagar/plexjs"; + +let value: Context = {}; +``` ## Fields diff --git a/docs/models/country.md b/docs/models/country.md index f533ce7f..784b7e2f 100644 --- a/docs/models/country.md +++ b/docs/models/country.md @@ -1,5 +1,14 @@ # Country +## Example Usage + +```typescript +import { Country } from "@lukehagar/plexjs"; + +let value: Country = { + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/createplaylisterrors.md b/docs/models/createplaylisterrors.md index e7767800..a74d991f 100644 --- a/docs/models/createplaylisterrors.md +++ b/docs/models/createplaylisterrors.md @@ -1,5 +1,16 @@ # CreatePlaylistErrors +## Example Usage + +```typescript +import { CreatePlaylistErrors } from "@lukehagar/plexjs"; + +let value: CreatePlaylistErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/createplaylistmediacontainer.md b/docs/models/createplaylistmediacontainer.md index 7da4e583..c0d0aea9 100644 --- a/docs/models/createplaylistmediacontainer.md +++ b/docs/models/createplaylistmediacontainer.md @@ -1,5 +1,34 @@ # CreatePlaylistMediaContainer +## Example Usage + +```typescript +import { CreatePlaylistMediaContainer } from "@lukehagar/plexjs"; + +let value: CreatePlaylistMediaContainer = { + size: 7, + metadata: [ + { + ratingKey: "96", + key: "/playlists/96/items", + guid: "com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55", + type: "playlist", + title: "A Great Playlist", + summary: "What a great playlist", + smart: false, + playlistType: "video", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705719589, + leafCount: 1, + addedAt: 1705719589, + updatedAt: 1705724593, + composite: "/playlists/96/composite/1705724593", + duration: 141000, + }, + ], +}; +``` ## Fields diff --git a/docs/models/createplaylistmetadata.md b/docs/models/createplaylistmetadata.md index fdf415d7..6506a15d 100644 --- a/docs/models/createplaylistmetadata.md +++ b/docs/models/createplaylistmetadata.md @@ -1,5 +1,29 @@ # CreatePlaylistMetadata +## Example Usage + +```typescript +import { CreatePlaylistMetadata } from "@lukehagar/plexjs"; + +let value: CreatePlaylistMetadata = { + ratingKey: "96", + key: "/playlists/96/items", + guid: "com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55", + type: "playlist", + title: "A Great Playlist", + summary: "What a great playlist", + smart: false, + playlistType: "video", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705719589, + leafCount: 1, + addedAt: 1705719589, + updatedAt: 1705724593, + composite: "/playlists/96/composite/1705724593", + duration: 141000, +}; +``` ## Fields diff --git a/docs/models/createplaylistplaylistsresponsebody.md b/docs/models/createplaylistplaylistsresponsebody.md index 1fcc07fe..93d2096b 100644 --- a/docs/models/createplaylistplaylistsresponsebody.md +++ b/docs/models/createplaylistplaylistsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { CreatePlaylistPlaylistsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/createplaylistrequest.md b/docs/models/createplaylistrequest.md index 341d084d..e2c05bd3 100644 --- a/docs/models/createplaylistrequest.md +++ b/docs/models/createplaylistrequest.md @@ -1,5 +1,17 @@ # CreatePlaylistRequest +## Example Usage + +```typescript +import { CreatePlaylistRequest, QueryParamType, Smart } from "@lukehagar/plexjs"; + +let value: CreatePlaylistRequest = { + title: "", + type: QueryParamType.Photo, + smart: Smart.One, + uri: "https://deadly-corsage.info", +}; +``` ## Fields diff --git a/docs/models/createplaylistresponse.md b/docs/models/createplaylistresponse.md index 52b94185..19cbb887 100644 --- a/docs/models/createplaylistresponse.md +++ b/docs/models/createplaylistresponse.md @@ -1,5 +1,43 @@ # CreatePlaylistResponse +## Example Usage + +```typescript +import { CreatePlaylistResponse } from "@lukehagar/plexjs"; + +let value: CreatePlaylistResponse = { + contentType: "", + statusCode: 128926, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 7, + metadata: [ + { + ratingKey: "96", + key: "/playlists/96/items", + guid: "com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55", + type: "playlist", + title: "A Great Playlist", + summary: "What a great playlist", + smart: false, + playlistType: "video", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705719589, + leafCount: 1, + addedAt: 1705719589, + updatedAt: 1705724593, + composite: "/playlists/96/composite/1705724593", + duration: 141000, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/createplaylistresponsebody.md b/docs/models/createplaylistresponsebody.md index e4b48fd1..77594d96 100644 --- a/docs/models/createplaylistresponsebody.md +++ b/docs/models/createplaylistresponsebody.md @@ -2,6 +2,37 @@ returns all playlists +## Example Usage + +```typescript +import { CreatePlaylistResponseBody } from "@lukehagar/plexjs"; + +let value: CreatePlaylistResponseBody = { + mediaContainer: { + size: 7, + metadata: [ + { + ratingKey: "96", + key: "/playlists/96/items", + guid: "com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55", + type: "playlist", + title: "A Great Playlist", + summary: "What a great playlist", + smart: false, + playlistType: "video", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705719589, + leafCount: 1, + addedAt: 1705719589, + updatedAt: 1705724593, + composite: "/playlists/96/composite/1705724593", + duration: 141000, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/deletelibraryerrors.md b/docs/models/deletelibraryerrors.md index 3daf65a3..4f784625 100644 --- a/docs/models/deletelibraryerrors.md +++ b/docs/models/deletelibraryerrors.md @@ -1,5 +1,16 @@ # DeleteLibraryErrors +## Example Usage + +```typescript +import { DeleteLibraryErrors } from "@lukehagar/plexjs"; + +let value: DeleteLibraryErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/deletelibraryrequest.md b/docs/models/deletelibraryrequest.md index 50b4f759..1689a752 100644 --- a/docs/models/deletelibraryrequest.md +++ b/docs/models/deletelibraryrequest.md @@ -1,5 +1,14 @@ # DeleteLibraryRequest +## Example Usage + +```typescript +import { DeleteLibraryRequest } from "@lukehagar/plexjs"; + +let value: DeleteLibraryRequest = { + sectionId: 1000, +}; +``` ## Fields diff --git a/docs/models/deletelibraryresponse.md b/docs/models/deletelibraryresponse.md index 36d1f6bb..45015704 100644 --- a/docs/models/deletelibraryresponse.md +++ b/docs/models/deletelibraryresponse.md @@ -1,5 +1,18 @@ # DeleteLibraryResponse +## Example Usage + +```typescript +import { DeleteLibraryResponse } from "@lukehagar/plexjs"; + +let value: DeleteLibraryResponse = { + contentType: "", + statusCode: 736918, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/deletelibraryresponsebody.md b/docs/models/deletelibraryresponsebody.md index 3f71ead9..7a103927 100644 --- a/docs/models/deletelibraryresponsebody.md +++ b/docs/models/deletelibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { DeleteLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/deleteplaylisterrors.md b/docs/models/deleteplaylisterrors.md index 0faea45c..31170fba 100644 --- a/docs/models/deleteplaylisterrors.md +++ b/docs/models/deleteplaylisterrors.md @@ -1,5 +1,16 @@ # DeletePlaylistErrors +## Example Usage + +```typescript +import { DeletePlaylistErrors } from "@lukehagar/plexjs"; + +let value: DeletePlaylistErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/deleteplaylistrequest.md b/docs/models/deleteplaylistrequest.md index 90ff45e2..246328b0 100644 --- a/docs/models/deleteplaylistrequest.md +++ b/docs/models/deleteplaylistrequest.md @@ -1,5 +1,14 @@ # DeletePlaylistRequest +## Example Usage + +```typescript +import { DeletePlaylistRequest } from "@lukehagar/plexjs"; + +let value: DeletePlaylistRequest = { + playlistID: 5701.97, +}; +``` ## Fields diff --git a/docs/models/deleteplaylistresponse.md b/docs/models/deleteplaylistresponse.md index dad36640..968b6fc0 100644 --- a/docs/models/deleteplaylistresponse.md +++ b/docs/models/deleteplaylistresponse.md @@ -1,5 +1,18 @@ # DeletePlaylistResponse +## Example Usage + +```typescript +import { DeletePlaylistResponse } from "@lukehagar/plexjs"; + +let value: DeletePlaylistResponse = { + contentType: "", + statusCode: 38425, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/deleteplaylistresponsebody.md b/docs/models/deleteplaylistresponsebody.md index ae45f2b2..03b54085 100644 --- a/docs/models/deleteplaylistresponsebody.md +++ b/docs/models/deleteplaylistresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { DeletePlaylistResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/device.md b/docs/models/device.md index 504a9f14..94b464aa 100644 --- a/docs/models/device.md +++ b/docs/models/device.md @@ -1,5 +1,17 @@ # Device +## Example Usage + +```typescript +import { Device } from "@lukehagar/plexjs"; + +let value: Device = { + id: 1, + name: "iPhone", + platform: "iOS", + createdAt: 1654131230, +}; +``` ## Fields diff --git a/docs/models/director.md b/docs/models/director.md index 0101aa59..cae403f6 100644 --- a/docs/models/director.md +++ b/docs/models/director.md @@ -1,5 +1,14 @@ # Director +## Example Usage + +```typescript +import { Director } from "@lukehagar/plexjs"; + +let value: Director = { + tag: "Peyton Reed", +}; +``` ## Fields diff --git a/docs/models/directory.md b/docs/models/directory.md index 34248ce3..8a8ba0c2 100644 --- a/docs/models/directory.md +++ b/docs/models/directory.md @@ -1,5 +1,12 @@ # Directory +## Example Usage + +```typescript +import { Directory } from "@lukehagar/plexjs"; + +let value: Directory = {}; +``` ## Fields diff --git a/docs/models/download.md b/docs/models/download.md index a29a21ff..1a66f2fc 100644 --- a/docs/models/download.md +++ b/docs/models/download.md @@ -2,6 +2,13 @@ Indicate that you want to start download any updates found. +## Example Usage + +```typescript +import { Download } from "@lukehagar/plexjs"; + +let value: Download = Download.One; +``` ## Values diff --git a/docs/models/enablepapertrailerrors.md b/docs/models/enablepapertrailerrors.md index 1f2b81ac..969da5ef 100644 --- a/docs/models/enablepapertrailerrors.md +++ b/docs/models/enablepapertrailerrors.md @@ -1,5 +1,16 @@ # EnablePaperTrailErrors +## Example Usage + +```typescript +import { EnablePaperTrailErrors } from "@lukehagar/plexjs"; + +let value: EnablePaperTrailErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/enablepapertrailresponse.md b/docs/models/enablepapertrailresponse.md index 63280257..cda73ff7 100644 --- a/docs/models/enablepapertrailresponse.md +++ b/docs/models/enablepapertrailresponse.md @@ -1,5 +1,18 @@ # EnablePaperTrailResponse +## Example Usage + +```typescript +import { EnablePaperTrailResponse } from "@lukehagar/plexjs"; + +let value: EnablePaperTrailResponse = { + contentType: "", + statusCode: 99280, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/enablepapertrailresponsebody.md b/docs/models/enablepapertrailresponsebody.md index 14d6c7f7..575204b0 100644 --- a/docs/models/enablepapertrailresponsebody.md +++ b/docs/models/enablepapertrailresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { EnablePaperTrailResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/errors.md b/docs/models/errors.md index bc6f5946..3de2dd1e 100644 --- a/docs/models/errors.md +++ b/docs/models/errors.md @@ -1,5 +1,16 @@ # Errors +## Example Usage + +```typescript +import { Errors } from "@lukehagar/plexjs"; + +let value: Errors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/features.md b/docs/models/features.md new file mode 100644 index 00000000..bc93cc20 --- /dev/null +++ b/docs/models/features.md @@ -0,0 +1,73 @@ +# Features + +## Example Usage + +```typescript +import { Features } from "@lukehagar/plexjs"; + +let value: Features = Features.SharedServerNotification; +``` + +## Values + +| Name | Value | +| --------------------------------------- | --------------------------------------- | +| `AndroidDolbyVision` | Android - Dolby Vision | +| `AndroidPiP` | Android - PiP | +| `CUSunset` | CU Sunset | +| `HRKEnableEUR` | HRK_enable_EUR | +| `TREBLEShowFeatures` | TREBLE-show-features | +| `AdCountdownTimer` | ad-countdown-timer | +| `AdaptiveBitrate` | adaptive_bitrate | +| `AmazonLoopDebug` | amazon-loop-debug | +| `AvodAdAnalysis` | avod-ad-analysis | +| `AvodNewMedia` | avod-new-media | +| `BlacklistGetSignin` | blacklist_get_signin | +| `ClientRadioStations` | client-radio-stations | +| `CloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `Collections` | collections | +| `CommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `CommunityAccessPlexTv` | community_access_plex_tv | +| `CompanionsSonos` | companions_sonos | +| `CustomHomeRemoval` | custom-home-removal | +| `DisableHomeUserFriendships` | disable_home_user_friendships | +| `DisableSharingFriendships` | disable_sharing_friendships | +| `DrmSupport` | drm_support | +| `ExcludeRestrictions` | exclude restrictions | +| `FederatedAuth` | federated-auth | +| `FriendRequestPushNotifications` | friend_request_push_notifications | +| `GuidedUpgrade` | guided-upgrade | +| `Home` | home | +| `IncreasePasswordComplexity` | increase-password-complexity | +| `Ios14PrivacyBanner` | ios14-privacy-banner | +| `IterableNotificationTokens` | iterable-notification-tokens | +| `KeepPaymentMethod` | keep-payment-method | +| `KevinBacon` | kevin-bacon | +| `KoreaConsent` | korea-consent | +| `LeIsrgRootX1` | le_isrg_root_x1 | +| `LetsEncrypt` | lets_encrypt | +| `LightningDvrPivot` | lightning-dvr-pivot | +| `LiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `Livetv` | livetv | +| `MetadataSearch` | metadata_search | +| `NewPlexPassPrices` | new_plex_pass_prices | +| `NewsProviderSunsetModal` | news-provider-sunset-modal | +| `PhotosFavorites` | photos-favorites | +| `PhotosMetadataEdition` | photos-metadata-edition | +| `PmsHealth` | pms_health | +| `Radio` | radio | +| `RateLimitClientToken` | rate-limit-client-token | +| `ScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `SharedServerNotification` | shared_server_notification | +| `SharedSourceNotification` | shared_source_notification | +| `SigninWithApple` | signin_with_apple | +| `SpringServeAdProvider` | spring_serve_ad_provider | +| `TranscoderCache` | transcoder_cache | +| `TunerSharing` | tuner-sharing | +| `TwoFactorAuthentication` | two-factor-authentication | +| `Unsupportedtuners` | unsupportedtuners | +| `Upgrade3ds2` | upgrade-3ds2 | +| `VodSchema` | vod-schema | +| `VodCloudflare` | vod_cloudflare | +| `WatchTogetherInvite` | watch-together-invite | +| `WebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/field.md b/docs/models/field.md index 2884fa7f..10afd5ec 100644 --- a/docs/models/field.md +++ b/docs/models/field.md @@ -1,5 +1,17 @@ # Field +## Example Usage + +```typescript +import { Field } from "@lukehagar/plexjs"; + +let value: Field = { + key: "label", + title: "Label", + type: "tag", + subType: "bitrate", +}; +``` ## Fields diff --git a/docs/models/fieldtype.md b/docs/models/fieldtype.md index 222dfc26..44983fa2 100644 --- a/docs/models/fieldtype.md +++ b/docs/models/fieldtype.md @@ -1,5 +1,20 @@ # FieldType +## Example Usage + +```typescript +import { FieldType } from "@lukehagar/plexjs"; + +let value: FieldType = { + type: "resolution", + operator: [ + { + key: "=", + title: "is", + }, + ], +}; +``` ## Fields diff --git a/docs/models/filter.md b/docs/models/filter.md index 6b3af5a1..d11fde16 100644 --- a/docs/models/filter.md +++ b/docs/models/filter.md @@ -4,6 +4,13 @@ Filters content by field and direction/equality (Unknown if viewedAt is the only supported column) +## Example Usage + +```typescript +import { Filter } from "@lukehagar/plexjs"; + +let value: Filter = {}; +``` ## Fields diff --git a/docs/models/force.md b/docs/models/force.md index f6407481..244e229b 100644 --- a/docs/models/force.md +++ b/docs/models/force.md @@ -6,6 +6,13 @@ The `force` argument is used to disable overwriting. If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. +## Example Usage + +```typescript +import { Force } from "@lukehagar/plexjs"; + +let value: Force = Force.One; +``` ## Values diff --git a/docs/models/friend.md b/docs/models/friend.md new file mode 100644 index 00000000..1f002227 --- /dev/null +++ b/docs/models/friend.md @@ -0,0 +1,39 @@ +# Friend + +## Example Usage + +```typescript +import { Friend, Status } from "@lukehagar/plexjs"; + +let value: Friend = { + email: "username@email.com", + friendlyName: "exampleUser", + home: true, + id: 0, + restricted: false, + sharedServers: [{}], + sharedSources: [{}], + status: Status.Accepted, + thumb: "https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578", + title: "username123", + username: "username123", + uuid: "7d1916e0d8f6e76b", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `email` | *string* | :heavy_check_mark: | The account email address | username@email.com | +| `friendlyName` | *string* | :heavy_check_mark: | The account full name | exampleUser | +| `home` | *boolean* | :heavy_check_mark: | If the account is a Plex Home user | | +| `id` | *number* | :heavy_check_mark: | The Plex account ID | | +| `restricted` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home managed user | | +| `sharedServers` | [models.SharedServers](../models/sharedservers.md)[] | :heavy_check_mark: | N/A | | +| `sharedSources` | [models.SharedSources](../models/sharedsources.md)[] | :heavy_check_mark: | N/A | | +| `status` | [models.Status](../models/status.md) | :heavy_check_mark: | Current friend request status | accepted | +| `thumb` | *string* | :heavy_check_mark: | URL of the account thumbnail | https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578 | +| `title` | *string* | :heavy_check_mark: | The title of the account (username or friendly name) | username123 | +| `username` | *string* | :heavy_check_mark: | The account username | username123 | +| `uuid` | *string* | :heavy_check_mark: | The account Universally Unique Identifier (UUID) | 7d1916e0d8f6e76b | \ No newline at end of file diff --git a/docs/models/genre.md b/docs/models/genre.md index 3592371c..105e7ed8 100644 --- a/docs/models/genre.md +++ b/docs/models/genre.md @@ -1,5 +1,14 @@ # Genre +## Example Usage + +```typescript +import { Genre } from "@lukehagar/plexjs"; + +let value: Genre = { + tag: "Comedy", +}; +``` ## Fields diff --git a/docs/models/geodata.md b/docs/models/geodata.md new file mode 100644 index 00000000..ba4f1e0d --- /dev/null +++ b/docs/models/geodata.md @@ -0,0 +1,39 @@ +# GeoData + +Geo location data + +## Example Usage + +```typescript +import { GeoData } from "@lukehagar/plexjs"; + +let value: GeoData = { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `code` | *string* | :heavy_check_mark: | The ISO 3166-1 alpha-2 code of the country. | VI | +| `continentCode` | *string* | :heavy_check_mark: | The continent code where the country is located. | NA | +| `country` | *string* | :heavy_check_mark: | The official name of the country. | United States Virgin Islands | +| `city` | *string* | :heavy_check_mark: | The name of the city. | Amsterdam | +| `europeanUnionMember` | *boolean* | :heavy_minus_sign: | Indicates if the country is a member of the European Union. | true | +| `timeZone` | *string* | :heavy_check_mark: | The time zone of the country. | America/St_Thomas | +| `postalCode` | *number* | :heavy_check_mark: | The postal code of the location. | 802 | +| `inPrivacyRestrictedCountry` | *boolean* | :heavy_minus_sign: | Indicates if the country has privacy restrictions. | true | +| `inPrivacyRestrictedRegion` | *boolean* | :heavy_minus_sign: | Indicates if the region has privacy restrictions. | true | +| `subdivisions` | *string* | :heavy_check_mark: | The name of the primary administrative subdivision. | Saint Thomas | +| `coordinates` | *string* | :heavy_check_mark: | The geographical coordinates (latitude, longitude) of the location. | 18.3381, -64.8941 | \ No newline at end of file diff --git a/docs/models/getavailableclientserrors.md b/docs/models/getavailableclientserrors.md index 815e8daa..f76df566 100644 --- a/docs/models/getavailableclientserrors.md +++ b/docs/models/getavailableclientserrors.md @@ -1,5 +1,16 @@ # GetAvailableClientsErrors +## Example Usage + +```typescript +import { GetAvailableClientsErrors } from "@lukehagar/plexjs"; + +let value: GetAvailableClientsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getavailableclientsmediacontainer.md b/docs/models/getavailableclientsmediacontainer.md index 75833c1a..35eb3126 100644 --- a/docs/models/getavailableclientsmediacontainer.md +++ b/docs/models/getavailableclientsmediacontainer.md @@ -1,5 +1,29 @@ # GetAvailableClientsMediaContainer +## Example Usage + +```typescript +import { GetAvailableClientsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetAvailableClientsMediaContainer = { + size: 1, + server: [ + { + name: "iPad", + host: "10.10.10.102", + address: "10.10.10.102", + port: 32500, + machineIdentifier: "A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05", + version: "8.17", + protocol: "plex", + product: "Plex for iOS", + deviceClass: "tablet", + protocolVersion: 2, + protocolCapabilities: "playback,playqueues,timeline,provider-playback", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getavailableclientsresponse.md b/docs/models/getavailableclientsresponse.md index 1c68c79d..55251729 100644 --- a/docs/models/getavailableclientsresponse.md +++ b/docs/models/getavailableclientsresponse.md @@ -1,5 +1,38 @@ # GetAvailableClientsResponse +## Example Usage + +```typescript +import { GetAvailableClientsResponse } from "@lukehagar/plexjs"; + +let value: GetAvailableClientsResponse = { + contentType: "", + statusCode: 715190, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + server: [ + { + name: "iPad", + host: "10.10.10.102", + address: "10.10.10.102", + port: 32500, + machineIdentifier: "A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05", + version: "8.17", + protocol: "plex", + product: "Plex for iOS", + deviceClass: "tablet", + protocolVersion: 2, + protocolCapabilities: "playback,playqueues,timeline,provider-playback", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getavailableclientsresponsebody.md b/docs/models/getavailableclientsresponsebody.md index 790a2c5c..6af08cb1 100644 --- a/docs/models/getavailableclientsresponsebody.md +++ b/docs/models/getavailableclientsresponsebody.md @@ -2,6 +2,32 @@ Available Clients +## Example Usage + +```typescript +import { GetAvailableClientsResponseBody } from "@lukehagar/plexjs"; + +let value: GetAvailableClientsResponseBody = { + mediaContainer: { + size: 1, + server: [ + { + name: "iPad", + host: "10.10.10.102", + address: "10.10.10.102", + port: 32500, + machineIdentifier: "A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05", + version: "8.17", + protocol: "plex", + product: "Plex for iOS", + deviceClass: "tablet", + protocolVersion: 2, + protocolCapabilities: "playback,playqueues,timeline,provider-playback", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getavailableclientsserver.md b/docs/models/getavailableclientsserver.md index f39223d3..0080df73 100644 --- a/docs/models/getavailableclientsserver.md +++ b/docs/models/getavailableclientsserver.md @@ -1,5 +1,24 @@ # GetAvailableClientsServer +## Example Usage + +```typescript +import { GetAvailableClientsServer } from "@lukehagar/plexjs"; + +let value: GetAvailableClientsServer = { + name: "iPad", + host: "10.10.10.102", + address: "10.10.10.102", + port: 32500, + machineIdentifier: "A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05", + version: "8.17", + protocol: "plex", + product: "Plex for iOS", + deviceClass: "tablet", + protocolVersion: 2, + protocolCapabilities: "playback,playqueues,timeline,provider-playback", +}; +``` ## Fields diff --git a/docs/models/getavailableclientsserverresponsebody.md b/docs/models/getavailableclientsserverresponsebody.md index cbbb53ee..f88f91f2 100644 --- a/docs/models/getavailableclientsserverresponsebody.md +++ b/docs/models/getavailableclientsserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetAvailableClientsServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsaccount.md b/docs/models/getbandwidthstatisticsaccount.md index a574208b..e2c85b49 100644 --- a/docs/models/getbandwidthstatisticsaccount.md +++ b/docs/models/getbandwidthstatisticsaccount.md @@ -1,5 +1,21 @@ # GetBandwidthStatisticsAccount +## Example Usage + +```typescript +import { GetBandwidthStatisticsAccount } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsAccount = { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsdevice.md b/docs/models/getbandwidthstatisticsdevice.md index 2791c67c..734258df 100644 --- a/docs/models/getbandwidthstatisticsdevice.md +++ b/docs/models/getbandwidthstatisticsdevice.md @@ -1,5 +1,18 @@ # GetBandwidthStatisticsDevice +## Example Usage + +```typescript +import { GetBandwidthStatisticsDevice } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsDevice = { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticserrors.md b/docs/models/getbandwidthstatisticserrors.md index 5fb3c4f2..0d06b67a 100644 --- a/docs/models/getbandwidthstatisticserrors.md +++ b/docs/models/getbandwidthstatisticserrors.md @@ -1,5 +1,16 @@ # GetBandwidthStatisticsErrors +## Example Usage + +```typescript +import { GetBandwidthStatisticsErrors } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsmediacontainer.md b/docs/models/getbandwidthstatisticsmediacontainer.md index d3122f86..62a03d4d 100644 --- a/docs/models/getbandwidthstatisticsmediacontainer.md +++ b/docs/models/getbandwidthstatisticsmediacontainer.md @@ -1,5 +1,44 @@ # GetBandwidthStatisticsMediaContainer +## Example Usage + +```typescript +import { GetBandwidthStatisticsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsMediaContainer = { + size: 5497, + device: [ + { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, + }, + ], + account: [ + { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", + }, + ], + statisticsBandwidth: [ + { + accountID: 238960586, + timespan: 6, + at: 1718387650, + lan: true, + bytes: 22, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsrequest.md b/docs/models/getbandwidthstatisticsrequest.md index 6b1d505a..82d6a56f 100644 --- a/docs/models/getbandwidthstatisticsrequest.md +++ b/docs/models/getbandwidthstatisticsrequest.md @@ -1,5 +1,14 @@ # GetBandwidthStatisticsRequest +## Example Usage + +```typescript +import { GetBandwidthStatisticsRequest } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsRequest = { + timespan: 4, +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsresponse.md b/docs/models/getbandwidthstatisticsresponse.md index 9f564dc4..b42a7b69 100644 --- a/docs/models/getbandwidthstatisticsresponse.md +++ b/docs/models/getbandwidthstatisticsresponse.md @@ -1,5 +1,53 @@ # GetBandwidthStatisticsResponse +## Example Usage + +```typescript +import { GetBandwidthStatisticsResponse } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsResponse = { + contentType: "", + statusCode: 623510, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 5497, + device: [ + { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, + }, + ], + account: [ + { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", + }, + ], + statisticsBandwidth: [ + { + accountID: 238960586, + timespan: 6, + at: 1718387650, + lan: true, + bytes: 22, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsresponsebody.md b/docs/models/getbandwidthstatisticsresponsebody.md index daabcff5..463e67f6 100644 --- a/docs/models/getbandwidthstatisticsresponsebody.md +++ b/docs/models/getbandwidthstatisticsresponsebody.md @@ -2,6 +2,47 @@ Bandwidth Statistics +## Example Usage + +```typescript +import { GetBandwidthStatisticsResponseBody } from "@lukehagar/plexjs"; + +let value: GetBandwidthStatisticsResponseBody = { + mediaContainer: { + size: 5497, + device: [ + { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, + }, + ], + account: [ + { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", + }, + ], + statisticsBandwidth: [ + { + accountID: 238960586, + timespan: 6, + at: 1718387650, + lan: true, + bytes: 22, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getbandwidthstatisticsstatisticsresponsebody.md b/docs/models/getbandwidthstatisticsstatisticsresponsebody.md index 73a3e529..ef0f3767 100644 --- a/docs/models/getbandwidthstatisticsstatisticsresponsebody.md +++ b/docs/models/getbandwidthstatisticsstatisticsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetBandwidthStatisticsStatisticsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getbutlertasksbutlerresponsebody.md b/docs/models/getbutlertasksbutlerresponsebody.md index aff97cf1..43ba0c0d 100644 --- a/docs/models/getbutlertasksbutlerresponsebody.md +++ b/docs/models/getbutlertasksbutlerresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetButlerTasksButlerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getbutlertaskserrors.md b/docs/models/getbutlertaskserrors.md index 59f0c6ce..50317026 100644 --- a/docs/models/getbutlertaskserrors.md +++ b/docs/models/getbutlertaskserrors.md @@ -1,5 +1,16 @@ # GetButlerTasksErrors +## Example Usage + +```typescript +import { GetButlerTasksErrors } from "@lukehagar/plexjs"; + +let value: GetButlerTasksErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getbutlertasksresponse.md b/docs/models/getbutlertasksresponse.md index 5ebf7719..0de7fe8c 100644 --- a/docs/models/getbutlertasksresponse.md +++ b/docs/models/getbutlertasksresponse.md @@ -1,5 +1,31 @@ # GetButlerTasksResponse +## Example Usage + +```typescript +import { GetButlerTasksResponse } from "@lukehagar/plexjs"; + +let value: GetButlerTasksResponse = { + contentType: "", + statusCode: 791725, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + butlerTasks: { + butlerTask: [ + { + name: "BackupDatabase", + interval: 3, + title: "Backup Database", + description: + "Create a backup copy of the server's database in the configured backup directory", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getbutlertasksresponsebody.md b/docs/models/getbutlertasksresponsebody.md index f7eeeec4..41533cdd 100644 --- a/docs/models/getbutlertasksresponsebody.md +++ b/docs/models/getbutlertasksresponsebody.md @@ -2,6 +2,25 @@ All butler tasks +## Example Usage + +```typescript +import { GetButlerTasksResponseBody } from "@lukehagar/plexjs"; + +let value: GetButlerTasksResponseBody = { + butlerTasks: { + butlerTask: [ + { + name: "BackupDatabase", + interval: 3, + title: "Backup Database", + description: + "Create a backup copy of the server's database in the configured backup directory", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getcompanionsdataerrors.md b/docs/models/getcompanionsdataerrors.md new file mode 100644 index 00000000..935d6076 --- /dev/null +++ b/docs/models/getcompanionsdataerrors.md @@ -0,0 +1,21 @@ +# GetCompanionsDataErrors + +## Example Usage + +```typescript +import { GetCompanionsDataErrors } from "@lukehagar/plexjs"; + +let value: GetCompanionsDataErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *number* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/getcompanionsdataresponse.md b/docs/models/getcompanionsdataresponse.md new file mode 100644 index 00000000..996cc128 --- /dev/null +++ b/docs/models/getcompanionsdataresponse.md @@ -0,0 +1,34 @@ +# GetCompanionsDataResponse + +## Example Usage + +```typescript +import { GetCompanionsDataResponse } from "@lukehagar/plexjs"; + +let value: GetCompanionsDataResponse = { + contentType: "", + statusCode: 337396, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + responseBodies: [ + { + identifier: "tv.plex.sonos", + baseURL: "https://sonos.plex.tv", + title: "Sonos", + linkURL: "https://sonos.plex.tv/link", + provides: "client,player", + token: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `responseBodies` | [models.ResponseBody](../models/responsebody.md)[] | :heavy_minus_sign: | Companions Data | \ No newline at end of file diff --git a/docs/models/getcompanionsdataresponsebody.md b/docs/models/getcompanionsdataresponsebody.md new file mode 100644 index 00000000..54765abb --- /dev/null +++ b/docs/models/getcompanionsdataresponsebody.md @@ -0,0 +1,18 @@ +# GetCompanionsDataResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + +## Example Usage + +```typescript +import { GetCompanionsDataResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `errors` | [models.GetCompanionsDataErrors](../models/getcompanionsdataerrors.md)[] | :heavy_minus_sign: | N/A | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/getdeviceserrors.md b/docs/models/getdeviceserrors.md index ed05754f..2e07d686 100644 --- a/docs/models/getdeviceserrors.md +++ b/docs/models/getdeviceserrors.md @@ -1,5 +1,16 @@ # GetDevicesErrors +## Example Usage + +```typescript +import { GetDevicesErrors } from "@lukehagar/plexjs"; + +let value: GetDevicesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getdevicesmediacontainer.md b/docs/models/getdevicesmediacontainer.md index cf4eb83f..6b8c8ef7 100644 --- a/docs/models/getdevicesmediacontainer.md +++ b/docs/models/getdevicesmediacontainer.md @@ -1,5 +1,23 @@ # GetDevicesMediaContainer +## Example Usage + +```typescript +import { GetDevicesMediaContainer } from "@lukehagar/plexjs"; + +let value: GetDevicesMediaContainer = { + size: 151, + identifier: "com.plexapp.system.devices", + device: [ + { + id: 1, + name: "iPhone", + platform: "iOS", + createdAt: 1654131230, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getdevicesresponse.md b/docs/models/getdevicesresponse.md index 13085189..8c1a2019 100644 --- a/docs/models/getdevicesresponse.md +++ b/docs/models/getdevicesresponse.md @@ -1,5 +1,32 @@ # GetDevicesResponse +## Example Usage + +```typescript +import { GetDevicesResponse } from "@lukehagar/plexjs"; + +let value: GetDevicesResponse = { + contentType: "", + statusCode: 844266, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 151, + identifier: "com.plexapp.system.devices", + device: [ + { + id: 1, + name: "iPhone", + platform: "iOS", + createdAt: 1654131230, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getdevicesresponsebody.md b/docs/models/getdevicesresponsebody.md index 679aede4..755767f1 100644 --- a/docs/models/getdevicesresponsebody.md +++ b/docs/models/getdevicesresponsebody.md @@ -2,6 +2,26 @@ Devices +## Example Usage + +```typescript +import { GetDevicesResponseBody } from "@lukehagar/plexjs"; + +let value: GetDevicesResponseBody = { + mediaContainer: { + size: 151, + identifier: "com.plexapp.system.devices", + device: [ + { + id: 1, + name: "iPhone", + platform: "iOS", + createdAt: 1654131230, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getdevicesserverresponsebody.md b/docs/models/getdevicesserverresponsebody.md index 1c9d3fcd..ed980e68 100644 --- a/docs/models/getdevicesserverresponsebody.md +++ b/docs/models/getdevicesserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetDevicesServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getfilehasherrors.md b/docs/models/getfilehasherrors.md index 6623ae4b..1aea98ca 100644 --- a/docs/models/getfilehasherrors.md +++ b/docs/models/getfilehasherrors.md @@ -1,5 +1,16 @@ # GetFileHashErrors +## Example Usage + +```typescript +import { GetFileHashErrors } from "@lukehagar/plexjs"; + +let value: GetFileHashErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getfilehashrequest.md b/docs/models/getfilehashrequest.md index 3c5933de..8eb6f134 100644 --- a/docs/models/getfilehashrequest.md +++ b/docs/models/getfilehashrequest.md @@ -1,5 +1,14 @@ # GetFileHashRequest +## Example Usage + +```typescript +import { GetFileHashRequest } from "@lukehagar/plexjs"; + +let value: GetFileHashRequest = { + url: "file://C:Image.png&type=13", +}; +``` ## Fields diff --git a/docs/models/getfilehashresponse.md b/docs/models/getfilehashresponse.md index 367be6a8..eacc574d 100644 --- a/docs/models/getfilehashresponse.md +++ b/docs/models/getfilehashresponse.md @@ -1,5 +1,18 @@ # GetFileHashResponse +## Example Usage + +```typescript +import { GetFileHashResponse } from "@lukehagar/plexjs"; + +let value: GetFileHashResponse = { + contentType: "", + statusCode: 414662, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/getfilehashresponsebody.md b/docs/models/getfilehashresponsebody.md index a36f9eff..8d323af3 100644 --- a/docs/models/getfilehashresponsebody.md +++ b/docs/models/getfilehashresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetFileHashResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getgeodataerrors.md b/docs/models/getgeodataerrors.md new file mode 100644 index 00000000..05f8aa07 --- /dev/null +++ b/docs/models/getgeodataerrors.md @@ -0,0 +1,21 @@ +# GetGeoDataErrors + +## Example Usage + +```typescript +import { GetGeoDataErrors } from "@lukehagar/plexjs"; + +let value: GetGeoDataErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *number* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/getgeodatageodata.md b/docs/models/getgeodatageodata.md new file mode 100644 index 00000000..8246c091 --- /dev/null +++ b/docs/models/getgeodatageodata.md @@ -0,0 +1,39 @@ +# GetGeoDataGeoData + +Geo location data + +## Example Usage + +```typescript +import { GetGeoDataGeoData } from "@lukehagar/plexjs"; + +let value: GetGeoDataGeoData = { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `code` | *string* | :heavy_check_mark: | The ISO 3166-1 alpha-2 code of the country. | VI | +| `continentCode` | *string* | :heavy_check_mark: | The continent code where the country is located. | NA | +| `country` | *string* | :heavy_check_mark: | The official name of the country. | United States Virgin Islands | +| `city` | *string* | :heavy_check_mark: | The name of the city. | Amsterdam | +| `europeanUnionMember` | *boolean* | :heavy_minus_sign: | Indicates if the country is a member of the European Union. | true | +| `timeZone` | *string* | :heavy_check_mark: | The time zone of the country. | America/St_Thomas | +| `postalCode` | *number* | :heavy_check_mark: | The postal code of the location. | 802 | +| `inPrivacyRestrictedCountry` | *boolean* | :heavy_minus_sign: | Indicates if the country has privacy restrictions. | true | +| `inPrivacyRestrictedRegion` | *boolean* | :heavy_minus_sign: | Indicates if the region has privacy restrictions. | true | +| `subdivisions` | *string* | :heavy_check_mark: | The name of the primary administrative subdivision. | Saint Thomas | +| `coordinates` | *string* | :heavy_check_mark: | The geographical coordinates (latitude, longitude) of the location. | 18.3381, -64.8941 | \ No newline at end of file diff --git a/docs/models/gettokenresponsebody.md b/docs/models/getgeodataresponse.md similarity index 56% rename from docs/models/gettokenresponsebody.md rename to docs/models/getgeodataresponse.md index b578df7f..8693817c 100644 --- a/docs/models/gettokenresponsebody.md +++ b/docs/models/getgeodataresponse.md @@ -1,21 +1,37 @@ -# GetTokenResponseBody +# GetGeoDataResponse -Access Token +## Example Usage +```typescript +import { GetGeoDataResponse } from "@lukehagar/plexjs"; + +let value: GetGeoDataResponse = { + contentType: "", + statusCode: 648172, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + geoData: { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", + }, +}; +``` ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *number* | :heavy_minus_sign: | PinID for use with authentication | 1272322473 | -| `code` | *string* | :heavy_minus_sign: | N/A | 3patfx1a78ukcbr7x0n9bl26t | -| `product` | *string* | :heavy_minus_sign: | N/A | Plex Web | -| `trusted` | *boolean* | :heavy_minus_sign: | N/A | | -| `qr` | *string* | :heavy_minus_sign: | a link to a QR code hosted on plex.tv
The QR code redirects to the relevant `plex.tv/link` authentication page
Which then prompts the user for the 4 Digit Link Pin
| https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t | -| `clientIdentifier` | *string* | :heavy_minus_sign: | N/A | Postman | -| `location` | [models.GetTokenLocation](../models/gettokenlocation.md) | :heavy_minus_sign: | N/A | | -| `expiresIn` | *number* | :heavy_minus_sign: | N/A | 1800 | -| `createdAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | N/A | 2023-04-12 17:00:03 +0000 UTC | -| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | N/A | 2023-04-12 17:30:03 +0000 UTC | -| `authToken` | *string* | :heavy_minus_sign: | N/A | | -| `newRegistration` | *string* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `geoData` | [models.GetGeoDataGeoData](../models/getgeodatageodata.md) | :heavy_minus_sign: | Gets the geo location data of the user | {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
} | \ No newline at end of file diff --git a/docs/models/getpinplexresponsebody.md b/docs/models/getgeodataresponsebody.md similarity index 73% rename from docs/models/getpinplexresponsebody.md rename to docs/models/getgeodataresponsebody.md index dae58061..85f0185f 100644 --- a/docs/models/getpinplexresponsebody.md +++ b/docs/models/getgeodataresponsebody.md @@ -1,11 +1,18 @@ -# GetPinPlexResponseBody +# GetGeoDataResponseBody -X-Plex-Client-Identifier is missing +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetGeoDataResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields | Field | Type | Required | Description | | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `errors` | [models.GetPinErrors](../models/getpinerrors.md)[] | :heavy_minus_sign: | N/A | +| `errors` | [models.GetGeoDataErrors](../models/getgeodataerrors.md)[] | :heavy_minus_sign: | N/A | | `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/getglobalhubserrors.md b/docs/models/getglobalhubserrors.md index 39069450..d555b4c5 100644 --- a/docs/models/getglobalhubserrors.md +++ b/docs/models/getglobalhubserrors.md @@ -1,5 +1,16 @@ # GetGlobalHubsErrors +## Example Usage + +```typescript +import { GetGlobalHubsErrors } from "@lukehagar/plexjs"; + +let value: GetGlobalHubsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getglobalhubshubsresponsebody.md b/docs/models/getglobalhubshubsresponsebody.md index a56cdcc8..8d61837d 100644 --- a/docs/models/getglobalhubshubsresponsebody.md +++ b/docs/models/getglobalhubshubsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetGlobalHubsHubsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getglobalhubsmediacontainer.md b/docs/models/getglobalhubsmediacontainer.md index 579d26bd..49c13486 100644 --- a/docs/models/getglobalhubsmediacontainer.md +++ b/docs/models/getglobalhubsmediacontainer.md @@ -1,5 +1,51 @@ # GetGlobalHubsMediaContainer +## Example Usage + +```typescript +import { GetGlobalHubsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetGlobalHubsMediaContainer = { + size: 8, + allowSync: true, + identifier: "com.plexapp.plugins.library", + hub: [ + { + hubKey: "/library/metadata/50768,65523,58188,57341,57302,57070", + key: "/playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio", + title: "Recent Playlists", + type: "playlist", + hubIdentifier: "home.playlists", + context: "hub.home.playlists", + size: 6, + more: true, + style: "shelf", + promoted: true, + metadata: [ + { + ratingKey: "57070", + key: "/playlists/57070/items", + guid: "com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c", + type: "playlist", + title: "November Movie Day", + titleSort: "Tracks", + summary: "", + smart: false, + playlistType: "video", + composite: "/playlists/57070/composite/1668787730", + icon: "playlist://image.smart", + viewCount: 2, + lastViewedAt: 1668787732, + duration: 16873000, + leafCount: 3, + addedAt: 1668779618, + updatedAt: 1668787730, + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getglobalhubsmetadata.md b/docs/models/getglobalhubsmetadata.md index 3f049f49..903082b6 100644 --- a/docs/models/getglobalhubsmetadata.md +++ b/docs/models/getglobalhubsmetadata.md @@ -1,5 +1,30 @@ # GetGlobalHubsMetadata +## Example Usage + +```typescript +import { GetGlobalHubsMetadata } from "@lukehagar/plexjs"; + +let value: GetGlobalHubsMetadata = { + ratingKey: "57070", + key: "/playlists/57070/items", + guid: "com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c", + type: "playlist", + title: "November Movie Day", + titleSort: "Tracks", + summary: "", + smart: false, + playlistType: "video", + composite: "/playlists/57070/composite/1668787730", + icon: "playlist://image.smart", + viewCount: 2, + lastViewedAt: 1668787732, + duration: 16873000, + leafCount: 3, + addedAt: 1668779618, + updatedAt: 1668787730, +}; +``` ## Fields diff --git a/docs/models/getglobalhubsrequest.md b/docs/models/getglobalhubsrequest.md index 05e0a576..6ebd56c0 100644 --- a/docs/models/getglobalhubsrequest.md +++ b/docs/models/getglobalhubsrequest.md @@ -1,5 +1,12 @@ # GetGlobalHubsRequest +## Example Usage + +```typescript +import { GetGlobalHubsRequest } from "@lukehagar/plexjs"; + +let value: GetGlobalHubsRequest = {}; +``` ## Fields diff --git a/docs/models/getglobalhubsresponse.md b/docs/models/getglobalhubsresponse.md index 152c78b6..0f4b005b 100644 --- a/docs/models/getglobalhubsresponse.md +++ b/docs/models/getglobalhubsresponse.md @@ -1,5 +1,60 @@ # GetGlobalHubsResponse +## Example Usage + +```typescript +import { GetGlobalHubsResponse } from "@lukehagar/plexjs"; + +let value: GetGlobalHubsResponse = { + contentType: "", + statusCode: 639921, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 8, + allowSync: true, + identifier: "com.plexapp.plugins.library", + hub: [ + { + hubKey: "/library/metadata/50768,65523,58188,57341,57302,57070", + key: "/playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio", + title: "Recent Playlists", + type: "playlist", + hubIdentifier: "home.playlists", + context: "hub.home.playlists", + size: 6, + more: true, + style: "shelf", + promoted: true, + metadata: [ + { + ratingKey: "57070", + key: "/playlists/57070/items", + guid: "com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c", + type: "playlist", + title: "November Movie Day", + titleSort: "Tracks", + summary: "", + smart: false, + playlistType: "video", + composite: "/playlists/57070/composite/1668787730", + icon: "playlist://image.smart", + viewCount: 2, + lastViewedAt: 1668787732, + duration: 16873000, + leafCount: 3, + addedAt: 1668779618, + updatedAt: 1668787730, + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getglobalhubsresponsebody.md b/docs/models/getglobalhubsresponsebody.md index b7537392..91603600 100644 --- a/docs/models/getglobalhubsresponsebody.md +++ b/docs/models/getglobalhubsresponsebody.md @@ -2,6 +2,54 @@ returns global hubs +## Example Usage + +```typescript +import { GetGlobalHubsResponseBody } from "@lukehagar/plexjs"; + +let value: GetGlobalHubsResponseBody = { + mediaContainer: { + size: 8, + allowSync: true, + identifier: "com.plexapp.plugins.library", + hub: [ + { + hubKey: "/library/metadata/50768,65523,58188,57341,57302,57070", + key: "/playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio", + title: "Recent Playlists", + type: "playlist", + hubIdentifier: "home.playlists", + context: "hub.home.playlists", + size: 6, + more: true, + style: "shelf", + promoted: true, + metadata: [ + { + ratingKey: "57070", + key: "/playlists/57070/items", + guid: "com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c", + type: "playlist", + title: "November Movie Day", + titleSort: "Tracks", + summary: "", + smart: false, + playlistType: "video", + composite: "/playlists/57070/composite/1668787730", + icon: "playlist://image.smart", + viewCount: 2, + lastViewedAt: 1668787732, + duration: 16873000, + leafCount: 3, + addedAt: 1668779618, + updatedAt: 1668787730, + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/gethomedataerrors.md b/docs/models/gethomedataerrors.md index 86bce8ef..a29d3177 100644 --- a/docs/models/gethomedataerrors.md +++ b/docs/models/gethomedataerrors.md @@ -1,5 +1,16 @@ # GetHomeDataErrors +## Example Usage + +```typescript +import { GetHomeDataErrors } from "@lukehagar/plexjs"; + +let value: GetHomeDataErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/gethomedataplexresponsebody.md b/docs/models/gethomedataplexresponsebody.md index 7ea0b26a..3f3e0c42 100644 --- a/docs/models/gethomedataplexresponsebody.md +++ b/docs/models/gethomedataplexresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetHomeDataPlexResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/gethomedataresponse.md b/docs/models/gethomedataresponse.md index ce12f3c5..dc75c2a7 100644 --- a/docs/models/gethomedataresponse.md +++ b/docs/models/gethomedataresponse.md @@ -1,5 +1,24 @@ # GetHomeDataResponse +## Example Usage + +```typescript +import { GetHomeDataResponse } from "@lukehagar/plexjs"; + +let value: GetHomeDataResponse = { + contentType: "", + statusCode: 20218, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + id: 1841489, + name: "Blindkitty38's home", + guestUserID: 58815432, + guestUserUUID: "f3df4e01bfca0787", + }, +}; +``` ## Fields diff --git a/docs/models/gethomedataresponsebody.md b/docs/models/gethomedataresponsebody.md index aeb3da20..862c98ec 100644 --- a/docs/models/gethomedataresponsebody.md +++ b/docs/models/gethomedataresponsebody.md @@ -2,6 +2,18 @@ Home Data +## Example Usage + +```typescript +import { GetHomeDataResponseBody } from "@lukehagar/plexjs"; + +let value: GetHomeDataResponseBody = { + id: 1841489, + name: "Blindkitty38's home", + guestUserID: 58815432, + guestUserUUID: "f3df4e01bfca0787", +}; +``` ## Fields diff --git a/docs/models/getlibrariesdirectory.md b/docs/models/getlibrariesdirectory.md index bf260b9e..9bd3c925 100644 --- a/docs/models/getlibrariesdirectory.md +++ b/docs/models/getlibrariesdirectory.md @@ -1,28 +1,62 @@ # GetLibrariesDirectory +## Example Usage + +```typescript +import { GetLibrariesDirectory } from "@lukehagar/plexjs"; + +let value: GetLibrariesDirectory = { + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + composite: "/library/sections/1/composite/1705615584", + filters: true, + refreshing: false, + thumb: "/:/resources/movie.png", + key: "1", + type: "movie", + title: "Movies", + agent: "tv.plex.agents.movie", + scanner: "Plex Movie", + language: "en-US", + uuid: "322a231a-b7f7-49f5-920f-14c61199cd30", + updatedAt: 1705615634, + createdAt: 1654131312, + scannedAt: 1705615584, + content: true, + directory: true, + contentChangedAt: 3192854, + hidden: 0, + location: [ + { + id: 1, + path: "/movies", + }, + ], +}; +``` ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `allowSync` | *boolean* | :heavy_minus_sign: | N/A | true | -| `art` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | -| `composite` | *string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 | -| `filters` | *boolean* | :heavy_minus_sign: | N/A | true | -| `refreshing` | *boolean* | :heavy_minus_sign: | N/A | false | -| `thumb` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | -| `key` | *string* | :heavy_minus_sign: | N/A | 1 | -| `type` | *string* | :heavy_minus_sign: | N/A | movie | -| `title` | *string* | :heavy_minus_sign: | N/A | Movies | -| `agent` | *string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie | -| `scanner` | *string* | :heavy_minus_sign: | N/A | Plex Movie | -| `language` | *string* | :heavy_minus_sign: | N/A | en-US | -| `uuid` | *string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 | -| `updatedAt` | *number* | :heavy_minus_sign: | N/A | 1705615634 | -| `createdAt` | *number* | :heavy_minus_sign: | N/A | 1654131312 | -| `scannedAt` | *number* | :heavy_minus_sign: | N/A | 1705615584 | -| `content` | *boolean* | :heavy_minus_sign: | N/A | true | -| `directory` | *boolean* | :heavy_minus_sign: | N/A | true | -| `contentChangedAt` | *number* | :heavy_minus_sign: | N/A | 3192854 | -| `hidden` | *number* | :heavy_minus_sign: | N/A | 0 | -| `location` | [models.GetLibrariesLocation](../models/getlibrarieslocation.md)[] | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `allowSync` | *boolean* | :heavy_minus_sign: | N/A | true | +| `art` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | +| `composite` | *string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 | +| `filters` | *boolean* | :heavy_minus_sign: | N/A | true | +| `refreshing` | *boolean* | :heavy_minus_sign: | N/A | false | +| `thumb` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | +| `key` | *string* | :heavy_minus_sign: | N/A | 1 | +| `type` | *string* | :heavy_minus_sign: | N/A | movie | +| `title` | *string* | :heavy_minus_sign: | N/A | Movies | +| `agent` | *string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie | +| `scanner` | *string* | :heavy_minus_sign: | N/A | Plex Movie | +| `language` | *string* | :heavy_minus_sign: | N/A | en-US | +| `uuid` | *string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 | +| `updatedAt` | *number* | :heavy_minus_sign: | N/A | 1705615634 | +| `createdAt` | *number* | :heavy_minus_sign: | N/A | 1654131312 | +| `scannedAt` | *number* | :heavy_minus_sign: | N/A | 1705615584 | +| `content` | *boolean* | :heavy_minus_sign: | N/A | true | +| `directory` | *boolean* | :heavy_minus_sign: | N/A | true | +| `contentChangedAt` | *number* | :heavy_minus_sign: | N/A | 3192854 | +| `hidden` | *number* | :heavy_minus_sign: | N/A | 0 | +| `location` | [models.Location](../models/location.md)[] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/getlibrarieserrors.md b/docs/models/getlibrarieserrors.md index 185f02c9..0602ba1d 100644 --- a/docs/models/getlibrarieserrors.md +++ b/docs/models/getlibrarieserrors.md @@ -1,5 +1,16 @@ # GetLibrariesErrors +## Example Usage + +```typescript +import { GetLibrariesErrors } from "@lukehagar/plexjs"; + +let value: GetLibrariesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getlibrarieslibraryresponsebody.md b/docs/models/getlibrarieslibraryresponsebody.md index dd0471a7..f616551f 100644 --- a/docs/models/getlibrarieslibraryresponsebody.md +++ b/docs/models/getlibrarieslibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetLibrariesLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getlibrarieslocation.md b/docs/models/getlibrarieslocation.md deleted file mode 100644 index fadf69ee..00000000 --- a/docs/models/getlibrarieslocation.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetLibrariesLocation - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `id` | *number* | :heavy_minus_sign: | N/A | 1 | -| `path` | *string* | :heavy_minus_sign: | N/A | /movies | \ No newline at end of file diff --git a/docs/models/getlibrariesmediacontainer.md b/docs/models/getlibrariesmediacontainer.md index 60e6c478..6cdadf11 100644 --- a/docs/models/getlibrariesmediacontainer.md +++ b/docs/models/getlibrariesmediacontainer.md @@ -1,5 +1,46 @@ # GetLibrariesMediaContainer +## Example Usage + +```typescript +import { GetLibrariesMediaContainer } from "@lukehagar/plexjs"; + +let value: GetLibrariesMediaContainer = { + size: 5, + allowSync: false, + title1: "Plex Library", + directory: [ + { + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + composite: "/library/sections/1/composite/1705615584", + filters: true, + refreshing: false, + thumb: "/:/resources/movie.png", + key: "1", + type: "movie", + title: "Movies", + agent: "tv.plex.agents.movie", + scanner: "Plex Movie", + language: "en-US", + uuid: "322a231a-b7f7-49f5-920f-14c61199cd30", + updatedAt: 1705615634, + createdAt: 1654131312, + scannedAt: 1705615584, + content: true, + directory: true, + contentChangedAt: 3192854, + hidden: 0, + location: [ + { + id: 1, + path: "/movies", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getlibrariesresponse.md b/docs/models/getlibrariesresponse.md index d68909a7..0a1d8963 100644 --- a/docs/models/getlibrariesresponse.md +++ b/docs/models/getlibrariesresponse.md @@ -1,5 +1,55 @@ # GetLibrariesResponse +## Example Usage + +```typescript +import { GetLibrariesResponse } from "@lukehagar/plexjs"; + +let value: GetLibrariesResponse = { + contentType: "", + statusCode: 264555, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 5, + allowSync: false, + title1: "Plex Library", + directory: [ + { + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + composite: "/library/sections/1/composite/1705615584", + filters: true, + refreshing: false, + thumb: "/:/resources/movie.png", + key: "1", + type: "movie", + title: "Movies", + agent: "tv.plex.agents.movie", + scanner: "Plex Movie", + language: "en-US", + uuid: "322a231a-b7f7-49f5-920f-14c61199cd30", + updatedAt: 1705615634, + createdAt: 1654131312, + scannedAt: 1705615584, + content: true, + directory: true, + contentChangedAt: 3192854, + hidden: 0, + location: [ + { + id: 1, + path: "/movies", + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getlibrariesresponsebody.md b/docs/models/getlibrariesresponsebody.md index f3cae9d8..4aa660f6 100644 --- a/docs/models/getlibrariesresponsebody.md +++ b/docs/models/getlibrariesresponsebody.md @@ -2,6 +2,49 @@ The libraries available on the Server +## Example Usage + +```typescript +import { GetLibrariesResponseBody } from "@lukehagar/plexjs"; + +let value: GetLibrariesResponseBody = { + mediaContainer: { + size: 5, + allowSync: false, + title1: "Plex Library", + directory: [ + { + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + composite: "/library/sections/1/composite/1705615584", + filters: true, + refreshing: false, + thumb: "/:/resources/movie.png", + key: "1", + type: "movie", + title: "Movies", + agent: "tv.plex.agents.movie", + scanner: "Plex Movie", + language: "en-US", + uuid: "322a231a-b7f7-49f5-920f-14c61199cd30", + updatedAt: 1705615634, + createdAt: 1654131312, + scannedAt: 1705615584, + content: true, + directory: true, + contentChangedAt: 3192854, + hidden: 0, + location: [ + { + id: 1, + path: "/movies", + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getlibrarydirectory.md b/docs/models/getlibrarydirectory.md index 804e6f9e..b55c06a3 100644 --- a/docs/models/getlibrarydirectory.md +++ b/docs/models/getlibrarydirectory.md @@ -1,5 +1,18 @@ # GetLibraryDirectory +## Example Usage + +```typescript +import { GetLibraryDirectory } from "@lukehagar/plexjs"; + +let value: GetLibraryDirectory = { + key: "search?type=1", + title: "Search...", + secondary: true, + prompt: "Search Movies", + search: true, +}; +``` ## Fields diff --git a/docs/models/getlibraryerrors.md b/docs/models/getlibraryerrors.md index d4205438..d357e9f7 100644 --- a/docs/models/getlibraryerrors.md +++ b/docs/models/getlibraryerrors.md @@ -1,5 +1,16 @@ # GetLibraryErrors +## Example Usage + +```typescript +import { GetLibraryErrors } from "@lukehagar/plexjs"; + +let value: GetLibraryErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getlibraryfilter.md b/docs/models/getlibraryfilter.md index b4317d35..c6268d41 100644 --- a/docs/models/getlibraryfilter.md +++ b/docs/models/getlibraryfilter.md @@ -1,5 +1,18 @@ # GetLibraryFilter +## Example Usage + +```typescript +import { GetLibraryFilter } from "@lukehagar/plexjs"; + +let value: GetLibraryFilter = { + filter: "label", + filterType: "string", + key: "/library/sections/1/label", + title: "Labels", + type: "filter", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubscountry.md b/docs/models/getlibraryhubscountry.md index 5d579eb9..8a1b9e42 100644 --- a/docs/models/getlibraryhubscountry.md +++ b/docs/models/getlibraryhubscountry.md @@ -1,5 +1,14 @@ # GetLibraryHubsCountry +## Example Usage + +```typescript +import { GetLibraryHubsCountry } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsCountry = { + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsdirector.md b/docs/models/getlibraryhubsdirector.md index ac347c80..f057dac0 100644 --- a/docs/models/getlibraryhubsdirector.md +++ b/docs/models/getlibraryhubsdirector.md @@ -1,5 +1,14 @@ # GetLibraryHubsDirector +## Example Usage + +```typescript +import { GetLibraryHubsDirector } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsDirector = { + tag: "Nathan Greno", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubserrors.md b/docs/models/getlibraryhubserrors.md index 086c30cb..57ed31a4 100644 --- a/docs/models/getlibraryhubserrors.md +++ b/docs/models/getlibraryhubserrors.md @@ -1,5 +1,16 @@ # GetLibraryHubsErrors +## Example Usage + +```typescript +import { GetLibraryHubsErrors } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsgenre.md b/docs/models/getlibraryhubsgenre.md index 2081c25c..b828adae 100644 --- a/docs/models/getlibraryhubsgenre.md +++ b/docs/models/getlibraryhubsgenre.md @@ -1,5 +1,14 @@ # GetLibraryHubsGenre +## Example Usage + +```typescript +import { GetLibraryHubsGenre } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsGenre = { + tag: "Animation", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubshub.md b/docs/models/getlibraryhubshub.md index 3955c73c..53fa065f 100644 --- a/docs/models/getlibraryhubshub.md +++ b/docs/models/getlibraryhubshub.md @@ -1,5 +1,117 @@ # GetLibraryHubsHub +## Example Usage + +```typescript +import { GetLibraryHubsHub } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryHubsHub = { + key: "/library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0", + title: "Recently Played Movies", + type: "movie", + hubIdentifier: "movie.recentlyviewed.1", + context: "hub.movie.recentlyviewed", + size: 6, + more: true, + style: "shelf", + hubKey: "/library/metadata/66485,66098,57249,11449,5858,14944", + metadata: [ + { + ratingKey: "14944", + key: "/library/metadata/14944", + guid: "plex://movie/5d77686eeb5d26001f1eb339", + studio: "Walt Disney Animation Studios", + type: "movie", + title: "Tangled", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG", + summary: + "The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.", + rating: 8.9, + audienceRating: 8.7, + viewCount: 1, + lastViewedAt: 1704936047, + year: 2010, + tagline: "They're taking adventure to new lengths.", + thumb: "/library/metadata/14944/thumb/1705739847", + art: "/library/metadata/14944/art/1705739847", + duration: 6017237, + originallyAvailableAt: new RFCDate("2010-11-24T00:00:00Z"), + addedAt: 1589412494, + updatedAt: 1705739847, + audienceRatingImage: "rottentomatoes://image.rating.upright", + primaryExtraKey: "/library/metadata/14952", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 38247, + duration: 6017237, + bitrate: 2051, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 1, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Animation", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Nathan Greno", + }, + ], + role: [ + { + tag: "Donna Murphy", + }, + ], + writer: [ + { + tag: "Wilhelm Grimm", + }, + ], + skipCount: 1, + chapterSource: "media", + }, + ], + promoted: true, + random: true, +}; +``` ## Fields diff --git a/docs/models/getlibraryhubshubsresponsebody.md b/docs/models/getlibraryhubshubsresponsebody.md index 4fedf0fb..55c1a1a4 100644 --- a/docs/models/getlibraryhubshubsresponsebody.md +++ b/docs/models/getlibraryhubshubsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetLibraryHubsHubsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getlibraryhubsmedia.md b/docs/models/getlibraryhubsmedia.md index cff7c7fa..63705743 100644 --- a/docs/models/getlibraryhubsmedia.md +++ b/docs/models/getlibraryhubsmedia.md @@ -1,5 +1,43 @@ # GetLibraryHubsMedia +## Example Usage + +```typescript +import { GetLibraryHubsMedia } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsMedia = { + id: 38247, + duration: 6017237, + bitrate: 2051, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 1, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsmediacontainer.md b/docs/models/getlibraryhubsmediacontainer.md index 30cb543b..95f80420 100644 --- a/docs/models/getlibraryhubsmediacontainer.md +++ b/docs/models/getlibraryhubsmediacontainer.md @@ -1,5 +1,127 @@ # GetLibraryHubsMediaContainer +## Example Usage + +```typescript +import { GetLibraryHubsMediaContainer } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryHubsMediaContainer = { + size: 7, + allowSync: true, + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + hub: [ + { + key: "/library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0", + title: "Recently Played Movies", + type: "movie", + hubIdentifier: "movie.recentlyviewed.1", + context: "hub.movie.recentlyviewed", + size: 6, + more: true, + style: "shelf", + hubKey: "/library/metadata/66485,66098,57249,11449,5858,14944", + metadata: [ + { + ratingKey: "14944", + key: "/library/metadata/14944", + guid: "plex://movie/5d77686eeb5d26001f1eb339", + studio: "Walt Disney Animation Studios", + type: "movie", + title: "Tangled", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG", + summary: + "The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.", + rating: 8.9, + audienceRating: 8.7, + viewCount: 1, + lastViewedAt: 1704936047, + year: 2010, + tagline: "They're taking adventure to new lengths.", + thumb: "/library/metadata/14944/thumb/1705739847", + art: "/library/metadata/14944/art/1705739847", + duration: 6017237, + originallyAvailableAt: new RFCDate("2010-11-24T00:00:00Z"), + addedAt: 1589412494, + updatedAt: 1705739847, + audienceRatingImage: "rottentomatoes://image.rating.upright", + primaryExtraKey: "/library/metadata/14952", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 38247, + duration: 6017237, + bitrate: 2051, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 1, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Animation", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Nathan Greno", + }, + ], + role: [ + { + tag: "Donna Murphy", + }, + ], + writer: [ + { + tag: "Wilhelm Grimm", + }, + ], + skipCount: 1, + chapterSource: "media", + }, + ], + promoted: true, + random: true, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsmetadata.md b/docs/models/getlibraryhubsmetadata.md index b0ff15aa..adaa70f3 100644 --- a/docs/models/getlibraryhubsmetadata.md +++ b/docs/models/getlibraryhubsmetadata.md @@ -1,5 +1,102 @@ # GetLibraryHubsMetadata +## Example Usage + +```typescript +import { GetLibraryHubsMetadata } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryHubsMetadata = { + ratingKey: "14944", + key: "/library/metadata/14944", + guid: "plex://movie/5d77686eeb5d26001f1eb339", + studio: "Walt Disney Animation Studios", + type: "movie", + title: "Tangled", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG", + summary: + "The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.", + rating: 8.9, + audienceRating: 8.7, + viewCount: 1, + lastViewedAt: 1704936047, + year: 2010, + tagline: "They're taking adventure to new lengths.", + thumb: "/library/metadata/14944/thumb/1705739847", + art: "/library/metadata/14944/art/1705739847", + duration: 6017237, + originallyAvailableAt: new RFCDate("2010-11-24T00:00:00Z"), + addedAt: 1589412494, + updatedAt: 1705739847, + audienceRatingImage: "rottentomatoes://image.rating.upright", + primaryExtraKey: "/library/metadata/14952", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 38247, + duration: 6017237, + bitrate: 2051, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 1, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Animation", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Nathan Greno", + }, + ], + role: [ + { + tag: "Donna Murphy", + }, + ], + writer: [ + { + tag: "Wilhelm Grimm", + }, + ], + skipCount: 1, + chapterSource: "media", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubspart.md b/docs/models/getlibraryhubspart.md index a434e9a7..8adfbd38 100644 --- a/docs/models/getlibraryhubspart.md +++ b/docs/models/getlibraryhubspart.md @@ -1,5 +1,23 @@ # GetLibraryHubsPart +## Example Usage + +```typescript +import { GetLibraryHubsPart } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsPart = { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsrequest.md b/docs/models/getlibraryhubsrequest.md index bc8fc506..95b3471d 100644 --- a/docs/models/getlibraryhubsrequest.md +++ b/docs/models/getlibraryhubsrequest.md @@ -1,5 +1,14 @@ # GetLibraryHubsRequest +## Example Usage + +```typescript +import { GetLibraryHubsRequest } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsRequest = { + sectionId: 1433.53, +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsresponse.md b/docs/models/getlibraryhubsresponse.md index 54314834..9a9502f2 100644 --- a/docs/models/getlibraryhubsresponse.md +++ b/docs/models/getlibraryhubsresponse.md @@ -1,5 +1,136 @@ # GetLibraryHubsResponse +## Example Usage + +```typescript +import { GetLibraryHubsResponse } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryHubsResponse = { + contentType: "", + statusCode: 537373, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 7, + allowSync: true, + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + hub: [ + { + key: "/library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0", + title: "Recently Played Movies", + type: "movie", + hubIdentifier: "movie.recentlyviewed.1", + context: "hub.movie.recentlyviewed", + size: 6, + more: true, + style: "shelf", + hubKey: "/library/metadata/66485,66098,57249,11449,5858,14944", + metadata: [ + { + ratingKey: "14944", + key: "/library/metadata/14944", + guid: "plex://movie/5d77686eeb5d26001f1eb339", + studio: "Walt Disney Animation Studios", + type: "movie", + title: "Tangled", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG", + summary: + "The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.", + rating: 8.9, + audienceRating: 8.7, + viewCount: 1, + lastViewedAt: 1704936047, + year: 2010, + tagline: "They're taking adventure to new lengths.", + thumb: "/library/metadata/14944/thumb/1705739847", + art: "/library/metadata/14944/art/1705739847", + duration: 6017237, + originallyAvailableAt: new RFCDate("2010-11-24T00:00:00Z"), + addedAt: 1589412494, + updatedAt: 1705739847, + audienceRatingImage: "rottentomatoes://image.rating.upright", + primaryExtraKey: "/library/metadata/14952", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 38247, + duration: 6017237, + bitrate: 2051, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 1, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Animation", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Nathan Greno", + }, + ], + role: [ + { + tag: "Donna Murphy", + }, + ], + writer: [ + { + tag: "Wilhelm Grimm", + }, + ], + skipCount: 1, + chapterSource: "media", + }, + ], + promoted: true, + random: true, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsresponsebody.md b/docs/models/getlibraryhubsresponsebody.md index 9d0812e6..c0d8d7fd 100644 --- a/docs/models/getlibraryhubsresponsebody.md +++ b/docs/models/getlibraryhubsresponsebody.md @@ -2,6 +2,130 @@ The hubs specific to the library +## Example Usage + +```typescript +import { GetLibraryHubsResponseBody } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryHubsResponseBody = { + mediaContainer: { + size: 7, + allowSync: true, + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + hub: [ + { + key: "/library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0", + title: "Recently Played Movies", + type: "movie", + hubIdentifier: "movie.recentlyviewed.1", + context: "hub.movie.recentlyviewed", + size: 6, + more: true, + style: "shelf", + hubKey: "/library/metadata/66485,66098,57249,11449,5858,14944", + metadata: [ + { + ratingKey: "14944", + key: "/library/metadata/14944", + guid: "plex://movie/5d77686eeb5d26001f1eb339", + studio: "Walt Disney Animation Studios", + type: "movie", + title: "Tangled", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG", + summary: + "The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.", + rating: 8.9, + audienceRating: 8.7, + viewCount: 1, + lastViewedAt: 1704936047, + year: 2010, + tagline: "They're taking adventure to new lengths.", + thumb: "/library/metadata/14944/thumb/1705739847", + art: "/library/metadata/14944/art/1705739847", + duration: 6017237, + originallyAvailableAt: new RFCDate("2010-11-24T00:00:00Z"), + addedAt: 1589412494, + updatedAt: 1705739847, + audienceRatingImage: "rottentomatoes://image.rating.upright", + primaryExtraKey: "/library/metadata/14952", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 38247, + duration: 6017237, + bitrate: 2051, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 1, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 38247, + key: "/library/parts/38247/1589412494/file.mp4", + duration: 6017237, + file: "/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4", + size: 1545647447, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: true, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Animation", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Nathan Greno", + }, + ], + role: [ + { + tag: "Donna Murphy", + }, + ], + writer: [ + { + tag: "Wilhelm Grimm", + }, + ], + skipCount: 1, + chapterSource: "media", + }, + ], + promoted: true, + random: true, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getlibraryhubsrole.md b/docs/models/getlibraryhubsrole.md index c07f2fea..0fb2b10a 100644 --- a/docs/models/getlibraryhubsrole.md +++ b/docs/models/getlibraryhubsrole.md @@ -1,5 +1,14 @@ # GetLibraryHubsRole +## Example Usage + +```typescript +import { GetLibraryHubsRole } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsRole = { + tag: "Donna Murphy", +}; +``` ## Fields diff --git a/docs/models/getlibraryhubswriter.md b/docs/models/getlibraryhubswriter.md index 185eb4f7..91017838 100644 --- a/docs/models/getlibraryhubswriter.md +++ b/docs/models/getlibraryhubswriter.md @@ -1,5 +1,14 @@ # GetLibraryHubsWriter +## Example Usage + +```typescript +import { GetLibraryHubsWriter } from "@lukehagar/plexjs"; + +let value: GetLibraryHubsWriter = { + tag: "Wilhelm Grimm", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemscountry.md b/docs/models/getlibraryitemscountry.md index 9b10031b..48b4a5e4 100644 --- a/docs/models/getlibraryitemscountry.md +++ b/docs/models/getlibraryitemscountry.md @@ -1,5 +1,14 @@ # GetLibraryItemsCountry +## Example Usage + +```typescript +import { GetLibraryItemsCountry } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsCountry = { + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsdirector.md b/docs/models/getlibraryitemsdirector.md index a00a0ec1..8aa13831 100644 --- a/docs/models/getlibraryitemsdirector.md +++ b/docs/models/getlibraryitemsdirector.md @@ -1,5 +1,14 @@ # GetLibraryItemsDirector +## Example Usage + +```typescript +import { GetLibraryItemsDirector } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsDirector = { + tag: "James Cameron", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemserrors.md b/docs/models/getlibraryitemserrors.md index 55563efd..3ac78bd2 100644 --- a/docs/models/getlibraryitemserrors.md +++ b/docs/models/getlibraryitemserrors.md @@ -1,5 +1,16 @@ # GetLibraryItemsErrors +## Example Usage + +```typescript +import { GetLibraryItemsErrors } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsgenre.md b/docs/models/getlibraryitemsgenre.md index 3eacc120..7b4c4c0e 100644 --- a/docs/models/getlibraryitemsgenre.md +++ b/docs/models/getlibraryitemsgenre.md @@ -1,5 +1,14 @@ # GetLibraryItemsGenre +## Example Usage + +```typescript +import { GetLibraryItemsGenre } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsGenre = { + tag: "Adventure", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemslibraryresponsebody.md b/docs/models/getlibraryitemslibraryresponsebody.md index 3ba11def..d3832093 100644 --- a/docs/models/getlibraryitemslibraryresponsebody.md +++ b/docs/models/getlibraryitemslibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetLibraryItemsLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getlibraryitemsmedia.md b/docs/models/getlibraryitemsmedia.md index a6969231..74ae34f0 100644 --- a/docs/models/getlibraryitemsmedia.md +++ b/docs/models/getlibraryitemsmedia.md @@ -1,5 +1,37 @@ # GetLibraryItemsMedia +## Example Usage + +```typescript +import { GetLibraryItemsMedia } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsMedia = { + id: 119534, + duration: 11558112, + bitrate: 25025, + width: 3840, + height: 2072, + aspectRatio: 1.85, + audioChannels: 6, + audioCodec: "eac3", + videoCodec: "hevc", + videoResolution: "4k", + container: "mkv", + videoFrameRate: "24p", + videoProfile: "main 10", + part: [ + { + id: 119542, + key: "/library/parts/119542/1680457526/file.mkv", + duration: 11558112, + file: "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv", + size: 36158371307, + container: "mkv", + videoProfile: "main 10", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsmediacontainer.md b/docs/models/getlibraryitemsmediacontainer.md index bf19803b..dbe9c307 100644 --- a/docs/models/getlibraryitemsmediacontainer.md +++ b/docs/models/getlibraryitemsmediacontainer.md @@ -1,5 +1,137 @@ # GetLibraryItemsMediaContainer +## Example Usage + +```typescript +import { GetLibraryItemsMediaContainer } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryItemsMediaContainer = { + size: 70, + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + identifier: "com.plexapp.plugins.library", + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + thumb: "/:/resources/movie.png", + title1: "Movies", + title2: "Recently Released", + viewGroup: "movie", + viewMode: 65592, + mixedParents: true, + metadata: [ + { + ratingKey: "58683", + key: "/library/metadata/58683", + guid: "plex://movie/5d7768ba96b655001fdc0408", + studio: "20th Century Studios", + type: "movie", + title: "Avatar: The Way of Water", + contentRating: "PG-13", + summary: + "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", + rating: 7.6, + audienceRating: 9.2, + year: 2022, + tagline: "Return to Pandora.", + thumb: "/library/metadata/58683/thumb/1703239236", + art: "/library/metadata/58683/art/1703239236", + duration: 11558112, + originallyAvailableAt: new RFCDate("2022-12-14T00:00:00Z"), + addedAt: 1680457607, + updatedAt: 1703239236, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/58684", + ratingImage: "rottentomatoes://image.rating.ripe", + grandparentRatingKey: "66", + grandparentGuid: "plex://show/5d9c081b170e24001f2a7be4", + grandparentKey: "/library/metadata/66", + grandparentTitle: "Caprica", + grandparentThumb: "/library/metadata/66/thumb/1705716261", + grandparentArt: "/library/metadata/66/art/1705716261", + grandparentTheme: "/library/metadata/66/theme/1705716261", + media: [ + { + id: 119534, + duration: 11558112, + bitrate: 25025, + width: 3840, + height: 2072, + aspectRatio: 1.85, + audioChannels: 6, + audioCodec: "eac3", + videoCodec: "hevc", + videoResolution: "4k", + container: "mkv", + videoFrameRate: "24p", + videoProfile: "main 10", + part: [ + { + id: 119542, + key: "/library/parts/119542/1680457526/file.mkv", + duration: 11558112, + file: "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv", + size: 36158371307, + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Adventure", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "James Cameron", + }, + ], + writer: [ + { + tag: "James Cameron", + }, + ], + role: [ + { + tag: "Sigourney Weaver", + }, + ], + titleSort: "Whale", + viewCount: 1, + lastViewedAt: 1682752242, + originalTitle: "映画 ブラッククローバー 魔法帝の剣", + viewOffset: 5222500, + skipCount: 1, + index: 1, + theme: "/library/metadata/1/theme/1705636920", + leafCount: 14, + viewedLeafCount: 0, + childCount: 1, + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + parentRatingKey: "66", + parentGuid: "plex://show/5d9c081b170e24001f2a7be4", + parentStudio: "UCP", + parentKey: "/library/metadata/66", + parentTitle: "Caprica", + parentIndex: 1, + parentYear: 2010, + parentThumb: "/library/metadata/66/thumb/1705716261", + parentTheme: "/library/metadata/66/theme/1705716261", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsmetadata.md b/docs/models/getlibraryitemsmetadata.md index cfa908d8..740c0b96 100644 --- a/docs/models/getlibraryitemsmetadata.md +++ b/docs/models/getlibraryitemsmetadata.md @@ -1,5 +1,119 @@ # GetLibraryItemsMetadata +## Example Usage + +```typescript +import { GetLibraryItemsMetadata } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryItemsMetadata = { + ratingKey: "58683", + key: "/library/metadata/58683", + guid: "plex://movie/5d7768ba96b655001fdc0408", + studio: "20th Century Studios", + type: "movie", + title: "Avatar: The Way of Water", + contentRating: "PG-13", + summary: + "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", + rating: 7.6, + audienceRating: 9.2, + year: 2022, + tagline: "Return to Pandora.", + thumb: "/library/metadata/58683/thumb/1703239236", + art: "/library/metadata/58683/art/1703239236", + duration: 11558112, + originallyAvailableAt: new RFCDate("2022-12-14T00:00:00Z"), + addedAt: 1680457607, + updatedAt: 1703239236, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/58684", + ratingImage: "rottentomatoes://image.rating.ripe", + grandparentRatingKey: "66", + grandparentGuid: "plex://show/5d9c081b170e24001f2a7be4", + grandparentKey: "/library/metadata/66", + grandparentTitle: "Caprica", + grandparentThumb: "/library/metadata/66/thumb/1705716261", + grandparentArt: "/library/metadata/66/art/1705716261", + grandparentTheme: "/library/metadata/66/theme/1705716261", + media: [ + { + id: 119534, + duration: 11558112, + bitrate: 25025, + width: 3840, + height: 2072, + aspectRatio: 1.85, + audioChannels: 6, + audioCodec: "eac3", + videoCodec: "hevc", + videoResolution: "4k", + container: "mkv", + videoFrameRate: "24p", + videoProfile: "main 10", + part: [ + { + id: 119542, + key: "/library/parts/119542/1680457526/file.mkv", + duration: 11558112, + file: "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv", + size: 36158371307, + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Adventure", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "James Cameron", + }, + ], + writer: [ + { + tag: "James Cameron", + }, + ], + role: [ + { + tag: "Sigourney Weaver", + }, + ], + titleSort: "Whale", + viewCount: 1, + lastViewedAt: 1682752242, + originalTitle: "映画 ブラッククローバー 魔法帝の剣", + viewOffset: 5222500, + skipCount: 1, + index: 1, + theme: "/library/metadata/1/theme/1705636920", + leafCount: 14, + viewedLeafCount: 0, + childCount: 1, + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + parentRatingKey: "66", + parentGuid: "plex://show/5d9c081b170e24001f2a7be4", + parentStudio: "UCP", + parentKey: "/library/metadata/66", + parentTitle: "Caprica", + parentIndex: 1, + parentYear: 2010, + parentThumb: "/library/metadata/66/thumb/1705716261", + parentTheme: "/library/metadata/66/theme/1705716261", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemspart.md b/docs/models/getlibraryitemspart.md index 233cae16..b1c6335d 100644 --- a/docs/models/getlibraryitemspart.md +++ b/docs/models/getlibraryitemspart.md @@ -1,5 +1,20 @@ # GetLibraryItemsPart +## Example Usage + +```typescript +import { GetLibraryItemsPart } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsPart = { + id: 119542, + key: "/library/parts/119542/1680457526/file.mkv", + duration: 11558112, + file: "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv", + size: 36158371307, + container: "mkv", + videoProfile: "main 10", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsrequest.md b/docs/models/getlibraryitemsrequest.md index c57c0523..6dc0f586 100644 --- a/docs/models/getlibraryitemsrequest.md +++ b/docs/models/getlibraryitemsrequest.md @@ -1,5 +1,16 @@ # GetLibraryItemsRequest +## Example Usage + +```typescript +import { GetLibraryItemsRequest, Tag } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsRequest = { + sectionId: "", + tag: Tag.RecentlyViewed, + includeGuids: 1, +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsresponse.md b/docs/models/getlibraryitemsresponse.md index 4db6a77b..b72ad5d0 100644 --- a/docs/models/getlibraryitemsresponse.md +++ b/docs/models/getlibraryitemsresponse.md @@ -1,5 +1,146 @@ # GetLibraryItemsResponse +## Example Usage + +```typescript +import { GetLibraryItemsResponse } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryItemsResponse = { + contentType: "", + statusCode: 135218, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 70, + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + identifier: "com.plexapp.plugins.library", + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + thumb: "/:/resources/movie.png", + title1: "Movies", + title2: "Recently Released", + viewGroup: "movie", + viewMode: 65592, + mixedParents: true, + metadata: [ + { + ratingKey: "58683", + key: "/library/metadata/58683", + guid: "plex://movie/5d7768ba96b655001fdc0408", + studio: "20th Century Studios", + type: "movie", + title: "Avatar: The Way of Water", + contentRating: "PG-13", + summary: + "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", + rating: 7.6, + audienceRating: 9.2, + year: 2022, + tagline: "Return to Pandora.", + thumb: "/library/metadata/58683/thumb/1703239236", + art: "/library/metadata/58683/art/1703239236", + duration: 11558112, + originallyAvailableAt: new RFCDate("2022-12-14T00:00:00Z"), + addedAt: 1680457607, + updatedAt: 1703239236, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/58684", + ratingImage: "rottentomatoes://image.rating.ripe", + grandparentRatingKey: "66", + grandparentGuid: "plex://show/5d9c081b170e24001f2a7be4", + grandparentKey: "/library/metadata/66", + grandparentTitle: "Caprica", + grandparentThumb: "/library/metadata/66/thumb/1705716261", + grandparentArt: "/library/metadata/66/art/1705716261", + grandparentTheme: "/library/metadata/66/theme/1705716261", + media: [ + { + id: 119534, + duration: 11558112, + bitrate: 25025, + width: 3840, + height: 2072, + aspectRatio: 1.85, + audioChannels: 6, + audioCodec: "eac3", + videoCodec: "hevc", + videoResolution: "4k", + container: "mkv", + videoFrameRate: "24p", + videoProfile: "main 10", + part: [ + { + id: 119542, + key: "/library/parts/119542/1680457526/file.mkv", + duration: 11558112, + file: "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv", + size: 36158371307, + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Adventure", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "James Cameron", + }, + ], + writer: [ + { + tag: "James Cameron", + }, + ], + role: [ + { + tag: "Sigourney Weaver", + }, + ], + titleSort: "Whale", + viewCount: 1, + lastViewedAt: 1682752242, + originalTitle: "映画 ブラッククローバー 魔法帝の剣", + viewOffset: 5222500, + skipCount: 1, + index: 1, + theme: "/library/metadata/1/theme/1705636920", + leafCount: 14, + viewedLeafCount: 0, + childCount: 1, + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + parentRatingKey: "66", + parentGuid: "plex://show/5d9c081b170e24001f2a7be4", + parentStudio: "UCP", + parentKey: "/library/metadata/66", + parentTitle: "Caprica", + parentIndex: 1, + parentYear: 2010, + parentThumb: "/library/metadata/66/thumb/1705716261", + parentTheme: "/library/metadata/66/theme/1705716261", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsresponsebody.md b/docs/models/getlibraryitemsresponsebody.md index 063537bc..2e02accf 100644 --- a/docs/models/getlibraryitemsresponsebody.md +++ b/docs/models/getlibraryitemsresponsebody.md @@ -2,6 +2,140 @@ The contents of the library by section and tag +## Example Usage + +```typescript +import { GetLibraryItemsResponseBody } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetLibraryItemsResponseBody = { + mediaContainer: { + size: 70, + allowSync: true, + art: "/:/resources/movie-fanart.jpg", + identifier: "com.plexapp.plugins.library", + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + thumb: "/:/resources/movie.png", + title1: "Movies", + title2: "Recently Released", + viewGroup: "movie", + viewMode: 65592, + mixedParents: true, + metadata: [ + { + ratingKey: "58683", + key: "/library/metadata/58683", + guid: "plex://movie/5d7768ba96b655001fdc0408", + studio: "20th Century Studios", + type: "movie", + title: "Avatar: The Way of Water", + contentRating: "PG-13", + summary: + "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", + rating: 7.6, + audienceRating: 9.2, + year: 2022, + tagline: "Return to Pandora.", + thumb: "/library/metadata/58683/thumb/1703239236", + art: "/library/metadata/58683/art/1703239236", + duration: 11558112, + originallyAvailableAt: new RFCDate("2022-12-14T00:00:00Z"), + addedAt: 1680457607, + updatedAt: 1703239236, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/58684", + ratingImage: "rottentomatoes://image.rating.ripe", + grandparentRatingKey: "66", + grandparentGuid: "plex://show/5d9c081b170e24001f2a7be4", + grandparentKey: "/library/metadata/66", + grandparentTitle: "Caprica", + grandparentThumb: "/library/metadata/66/thumb/1705716261", + grandparentArt: "/library/metadata/66/art/1705716261", + grandparentTheme: "/library/metadata/66/theme/1705716261", + media: [ + { + id: 119534, + duration: 11558112, + bitrate: 25025, + width: 3840, + height: 2072, + aspectRatio: 1.85, + audioChannels: 6, + audioCodec: "eac3", + videoCodec: "hevc", + videoResolution: "4k", + container: "mkv", + videoFrameRate: "24p", + videoProfile: "main 10", + part: [ + { + id: 119542, + key: "/library/parts/119542/1680457526/file.mkv", + duration: 11558112, + file: "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv", + size: 36158371307, + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Adventure", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "James Cameron", + }, + ], + writer: [ + { + tag: "James Cameron", + }, + ], + role: [ + { + tag: "Sigourney Weaver", + }, + ], + titleSort: "Whale", + viewCount: 1, + lastViewedAt: 1682752242, + originalTitle: "映画 ブラッククローバー 魔法帝の剣", + viewOffset: 5222500, + skipCount: 1, + index: 1, + theme: "/library/metadata/1/theme/1705636920", + leafCount: 14, + viewedLeafCount: 0, + childCount: 1, + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + parentRatingKey: "66", + parentGuid: "plex://show/5d9c081b170e24001f2a7be4", + parentStudio: "UCP", + parentKey: "/library/metadata/66", + parentTitle: "Caprica", + parentIndex: 1, + parentYear: 2010, + parentThumb: "/library/metadata/66/thumb/1705716261", + parentTheme: "/library/metadata/66/theme/1705716261", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getlibraryitemsrole.md b/docs/models/getlibraryitemsrole.md index 6e8f1e24..b832eb09 100644 --- a/docs/models/getlibraryitemsrole.md +++ b/docs/models/getlibraryitemsrole.md @@ -1,5 +1,14 @@ # GetLibraryItemsRole +## Example Usage + +```typescript +import { GetLibraryItemsRole } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsRole = { + tag: "Sigourney Weaver", +}; +``` ## Fields diff --git a/docs/models/getlibraryitemswriter.md b/docs/models/getlibraryitemswriter.md index 137e3bfc..c0c89738 100644 --- a/docs/models/getlibraryitemswriter.md +++ b/docs/models/getlibraryitemswriter.md @@ -1,5 +1,14 @@ # GetLibraryItemsWriter +## Example Usage + +```typescript +import { GetLibraryItemsWriter } from "@lukehagar/plexjs"; + +let value: GetLibraryItemsWriter = { + tag: "James Cameron", +}; +``` ## Fields diff --git a/docs/models/getlibrarylibraryresponsebody.md b/docs/models/getlibrarylibraryresponsebody.md index 399c58eb..d4bbea89 100644 --- a/docs/models/getlibrarylibraryresponsebody.md +++ b/docs/models/getlibrarylibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetLibraryLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getlibrarymediacontainer.md b/docs/models/getlibrarymediacontainer.md index 22b14cd7..bfb8c8bb 100644 --- a/docs/models/getlibrarymediacontainer.md +++ b/docs/models/getlibrarymediacontainer.md @@ -1,5 +1,80 @@ # GetLibraryMediaContainer +## Example Usage + +```typescript +import { GetLibraryMediaContainer } from "@lukehagar/plexjs"; + +let value: GetLibraryMediaContainer = { + size: 29, + allowSync: false, + art: "/:/resources/movie-fanart.jpg", + content: "secondary", + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + thumb: "/:/resources/movie.png", + title1: "Movies", + viewGroup: "secondary", + viewMode: 65592, + directory: [ + { + key: "search?type=1", + title: "Search...", + secondary: true, + prompt: "Search Movies", + search: true, + }, + ], + type: [ + { + key: "/library/sections/1/all?type=1", + type: "movie", + title: "Movies", + active: false, + filter: [ + { + filter: "label", + filterType: "string", + key: "/library/sections/1/label", + title: "Labels", + type: "filter", + }, + ], + sort: [ + { + default: "asc", + defaultDirection: "desc", + descKey: "random:desc", + firstCharacterKey: "/library/sections/1/firstCharacter", + key: "random", + title: "Randomly", + }, + ], + field: [ + { + key: "label", + title: "Label", + type: "tag", + subType: "bitrate", + }, + ], + }, + ], + fieldType: [ + { + type: "resolution", + operator: [ + { + key: "=", + title: "is", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getlibraryrequest.md b/docs/models/getlibraryrequest.md index 801cf67c..c1b52504 100644 --- a/docs/models/getlibraryrequest.md +++ b/docs/models/getlibraryrequest.md @@ -1,5 +1,14 @@ # GetLibraryRequest +## Example Usage + +```typescript +import { GetLibraryRequest } from "@lukehagar/plexjs"; + +let value: GetLibraryRequest = { + sectionId: 1000, +}; +``` ## Fields diff --git a/docs/models/getlibraryresponse.md b/docs/models/getlibraryresponse.md index 879c36de..b338354c 100644 --- a/docs/models/getlibraryresponse.md +++ b/docs/models/getlibraryresponse.md @@ -1,5 +1,89 @@ # GetLibraryResponse +## Example Usage + +```typescript +import { GetLibraryResponse } from "@lukehagar/plexjs"; + +let value: GetLibraryResponse = { + contentType: "", + statusCode: 774234, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 29, + allowSync: false, + art: "/:/resources/movie-fanart.jpg", + content: "secondary", + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + thumb: "/:/resources/movie.png", + title1: "Movies", + viewGroup: "secondary", + viewMode: 65592, + directory: [ + { + key: "search?type=1", + title: "Search...", + secondary: true, + prompt: "Search Movies", + search: true, + }, + ], + type: [ + { + key: "/library/sections/1/all?type=1", + type: "movie", + title: "Movies", + active: false, + filter: [ + { + filter: "label", + filterType: "string", + key: "/library/sections/1/label", + title: "Labels", + type: "filter", + }, + ], + sort: [ + { + default: "asc", + defaultDirection: "desc", + descKey: "random:desc", + firstCharacterKey: "/library/sections/1/firstCharacter", + key: "random", + title: "Randomly", + }, + ], + field: [ + { + key: "label", + title: "Label", + type: "tag", + subType: "bitrate", + }, + ], + }, + ], + fieldType: [ + { + type: "resolution", + operator: [ + { + key: "=", + title: "is", + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getlibraryresponsebody.md b/docs/models/getlibraryresponsebody.md index 7f5b6676..b973a71c 100644 --- a/docs/models/getlibraryresponsebody.md +++ b/docs/models/getlibraryresponsebody.md @@ -2,6 +2,83 @@ The details of the library +## Example Usage + +```typescript +import { GetLibraryResponseBody } from "@lukehagar/plexjs"; + +let value: GetLibraryResponseBody = { + mediaContainer: { + size: 29, + allowSync: false, + art: "/:/resources/movie-fanart.jpg", + content: "secondary", + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + thumb: "/:/resources/movie.png", + title1: "Movies", + viewGroup: "secondary", + viewMode: 65592, + directory: [ + { + key: "search?type=1", + title: "Search...", + secondary: true, + prompt: "Search Movies", + search: true, + }, + ], + type: [ + { + key: "/library/sections/1/all?type=1", + type: "movie", + title: "Movies", + active: false, + filter: [ + { + filter: "label", + filterType: "string", + key: "/library/sections/1/label", + title: "Labels", + type: "filter", + }, + ], + sort: [ + { + default: "asc", + defaultDirection: "desc", + descKey: "random:desc", + firstCharacterKey: "/library/sections/1/firstCharacter", + key: "random", + title: "Randomly", + }, + ], + field: [ + { + key: "label", + title: "Label", + type: "tag", + subType: "bitrate", + }, + ], + }, + ], + fieldType: [ + { + type: "resolution", + operator: [ + { + key: "=", + title: "is", + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getlibrarytype.md b/docs/models/getlibrarytype.md index bbedf9cb..c7bd2f03 100644 --- a/docs/models/getlibrarytype.md +++ b/docs/models/getlibrarytype.md @@ -1,5 +1,44 @@ # GetLibraryType +## Example Usage + +```typescript +import { GetLibraryType } from "@lukehagar/plexjs"; + +let value: GetLibraryType = { + key: "/library/sections/1/all?type=1", + type: "movie", + title: "Movies", + active: false, + filter: [ + { + filter: "label", + filterType: "string", + key: "/library/sections/1/label", + title: "Labels", + type: "filter", + }, + ], + sort: [ + { + default: "asc", + defaultDirection: "desc", + descKey: "random:desc", + firstCharacterKey: "/library/sections/1/firstCharacter", + key: "random", + title: "Randomly", + }, + ], + field: [ + { + key: "label", + title: "Label", + type: "tag", + subType: "bitrate", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrendirectory.md b/docs/models/getmetadatachildrendirectory.md index e92b7cea..d94aaef4 100644 --- a/docs/models/getmetadatachildrendirectory.md +++ b/docs/models/getmetadatachildrendirectory.md @@ -1,5 +1,18 @@ # GetMetadataChildrenDirectory +## Example Usage + +```typescript +import { GetMetadataChildrenDirectory } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenDirectory = { + leafCount: 16, + thumb: "/library/metadata/30072/thumb/1705739923", + viewedLeafCount: 16, + key: "/library/metadata/30072/allLeaves", + title: "All episodes", +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrenerrors.md b/docs/models/getmetadatachildrenerrors.md index 46532a10..566653f2 100644 --- a/docs/models/getmetadatachildrenerrors.md +++ b/docs/models/getmetadatachildrenerrors.md @@ -1,5 +1,16 @@ # GetMetadataChildrenErrors +## Example Usage + +```typescript +import { GetMetadataChildrenErrors } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrenlibraryresponsebody.md b/docs/models/getmetadatachildrenlibraryresponsebody.md index 0518c839..6474241f 100644 --- a/docs/models/getmetadatachildrenlibraryresponsebody.md +++ b/docs/models/getmetadatachildrenlibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetMetadataChildrenLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getmetadatachildrenmediacontainer.md b/docs/models/getmetadatachildrenmediacontainer.md index 9ca49829..334985e5 100644 --- a/docs/models/getmetadatachildrenmediacontainer.md +++ b/docs/models/getmetadatachildrenmediacontainer.md @@ -1,5 +1,76 @@ # GetMetadataChildrenMediaContainer +## Example Usage + +```typescript +import { GetMetadataChildrenMediaContainer } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenMediaContainer = { + size: 3, + allowSync: true, + art: "/library/metadata/30072/art/1705739923", + identifier: "com.plexapp.plugins.library", + key: "30072", + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + nocache: true, + parentIndex: 1, + parentTitle: "Reacher", + parentYear: 2022, + summary: + "When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.", + theme: "/library/metadata/30072/theme/1705739923", + thumb: "/library/metadata/30072/thumb/1705739923", + title1: "TV Shows", + title2: "Reacher", + viewGroup: "season", + viewMode: 65593, + directory: [ + { + leafCount: 16, + thumb: "/library/metadata/30072/thumb/1705739923", + viewedLeafCount: 16, + key: "/library/metadata/30072/allLeaves", + title: "All episodes", + }, + ], + metadata: [ + { + ratingKey: "66488", + key: "/library/metadata/66488/children", + parentRatingKey: "30072", + guid: "plex://season/652aea6549508477c34c6000", + parentGuid: "plex://show/5d9c09190aaccd001f8f42f0", + parentStudio: "Amazon Studios", + type: "season", + title: "Season 2", + parentKey: "/library/metadata/30072", + parentTitle: "Reacher", + summary: + 'Based on"Bad Luck and Trouble," when members of Reacher\'s old military unit start turning up dead, Reacher has just one thing on his mind—revenge.', + index: 2, + parentIndex: 1, + viewCount: 11, + lastViewedAt: 1705646565, + parentYear: 2022, + thumb: "/library/metadata/66488/thumb/1703065033", + art: "/library/metadata/30072/art/1705739923", + parentThumb: "/library/metadata/30072/thumb/1705739923", + parentTheme: "/library/metadata/30072/theme/1705739923", + leafCount: 8, + viewedLeafCount: 8, + addedAt: 1702602021, + updatedAt: 1703065033, + userRating: 9, + skipCount: 1, + lastRatedAt: 1703881224, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrenmetadata.md b/docs/models/getmetadatachildrenmetadata.md index 0eee2f4e..91071236 100644 --- a/docs/models/getmetadatachildrenmetadata.md +++ b/docs/models/getmetadatachildrenmetadata.md @@ -1,5 +1,41 @@ # GetMetadataChildrenMetadata +## Example Usage + +```typescript +import { GetMetadataChildrenMetadata } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenMetadata = { + ratingKey: "66488", + key: "/library/metadata/66488/children", + parentRatingKey: "30072", + guid: "plex://season/652aea6549508477c34c6000", + parentGuid: "plex://show/5d9c09190aaccd001f8f42f0", + parentStudio: "Amazon Studios", + type: "season", + title: "Season 2", + parentKey: "/library/metadata/30072", + parentTitle: "Reacher", + summary: + 'Based on"Bad Luck and Trouble," when members of Reacher\'s old military unit start turning up dead, Reacher has just one thing on his mind—revenge.', + index: 2, + parentIndex: 1, + viewCount: 11, + lastViewedAt: 1705646565, + parentYear: 2022, + thumb: "/library/metadata/66488/thumb/1703065033", + art: "/library/metadata/30072/art/1705739923", + parentThumb: "/library/metadata/30072/thumb/1705739923", + parentTheme: "/library/metadata/30072/theme/1705739923", + leafCount: 8, + viewedLeafCount: 8, + addedAt: 1702602021, + updatedAt: 1703065033, + userRating: 9, + skipCount: 1, + lastRatedAt: 1703881224, +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrenrequest.md b/docs/models/getmetadatachildrenrequest.md index d225a19f..3f463c7e 100644 --- a/docs/models/getmetadatachildrenrequest.md +++ b/docs/models/getmetadatachildrenrequest.md @@ -1,5 +1,14 @@ # GetMetadataChildrenRequest +## Example Usage + +```typescript +import { GetMetadataChildrenRequest } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenRequest = { + ratingKey: 9437.49, +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrenresponse.md b/docs/models/getmetadatachildrenresponse.md index 1d25a9e9..d78af34f 100644 --- a/docs/models/getmetadatachildrenresponse.md +++ b/docs/models/getmetadatachildrenresponse.md @@ -1,5 +1,85 @@ # GetMetadataChildrenResponse +## Example Usage + +```typescript +import { GetMetadataChildrenResponse } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenResponse = { + contentType: "", + statusCode: 902599, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 3, + allowSync: true, + art: "/library/metadata/30072/art/1705739923", + identifier: "com.plexapp.plugins.library", + key: "30072", + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + nocache: true, + parentIndex: 1, + parentTitle: "Reacher", + parentYear: 2022, + summary: + "When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.", + theme: "/library/metadata/30072/theme/1705739923", + thumb: "/library/metadata/30072/thumb/1705739923", + title1: "TV Shows", + title2: "Reacher", + viewGroup: "season", + viewMode: 65593, + directory: [ + { + leafCount: 16, + thumb: "/library/metadata/30072/thumb/1705739923", + viewedLeafCount: 16, + key: "/library/metadata/30072/allLeaves", + title: "All episodes", + }, + ], + metadata: [ + { + ratingKey: "66488", + key: "/library/metadata/66488/children", + parentRatingKey: "30072", + guid: "plex://season/652aea6549508477c34c6000", + parentGuid: "plex://show/5d9c09190aaccd001f8f42f0", + parentStudio: "Amazon Studios", + type: "season", + title: "Season 2", + parentKey: "/library/metadata/30072", + parentTitle: "Reacher", + summary: + 'Based on"Bad Luck and Trouble," when members of Reacher\'s old military unit start turning up dead, Reacher has just one thing on his mind—revenge.', + index: 2, + parentIndex: 1, + viewCount: 11, + lastViewedAt: 1705646565, + parentYear: 2022, + thumb: "/library/metadata/66488/thumb/1703065033", + art: "/library/metadata/30072/art/1705739923", + parentThumb: "/library/metadata/30072/thumb/1705739923", + parentTheme: "/library/metadata/30072/theme/1705739923", + leafCount: 8, + viewedLeafCount: 8, + addedAt: 1702602021, + updatedAt: 1703065033, + userRating: 9, + skipCount: 1, + lastRatedAt: 1703881224, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getmetadatachildrenresponsebody.md b/docs/models/getmetadatachildrenresponsebody.md index 30a87d79..74b28e36 100644 --- a/docs/models/getmetadatachildrenresponsebody.md +++ b/docs/models/getmetadatachildrenresponsebody.md @@ -2,6 +2,79 @@ The children of the library item. +## Example Usage + +```typescript +import { GetMetadataChildrenResponseBody } from "@lukehagar/plexjs"; + +let value: GetMetadataChildrenResponseBody = { + mediaContainer: { + size: 3, + allowSync: true, + art: "/library/metadata/30072/art/1705739923", + identifier: "com.plexapp.plugins.library", + key: "30072", + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1701731894, + nocache: true, + parentIndex: 1, + parentTitle: "Reacher", + parentYear: 2022, + summary: + "When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.", + theme: "/library/metadata/30072/theme/1705739923", + thumb: "/library/metadata/30072/thumb/1705739923", + title1: "TV Shows", + title2: "Reacher", + viewGroup: "season", + viewMode: 65593, + directory: [ + { + leafCount: 16, + thumb: "/library/metadata/30072/thumb/1705739923", + viewedLeafCount: 16, + key: "/library/metadata/30072/allLeaves", + title: "All episodes", + }, + ], + metadata: [ + { + ratingKey: "66488", + key: "/library/metadata/66488/children", + parentRatingKey: "30072", + guid: "plex://season/652aea6549508477c34c6000", + parentGuid: "plex://show/5d9c09190aaccd001f8f42f0", + parentStudio: "Amazon Studios", + type: "season", + title: "Season 2", + parentKey: "/library/metadata/30072", + parentTitle: "Reacher", + summary: + 'Based on"Bad Luck and Trouble," when members of Reacher\'s old military unit start turning up dead, Reacher has just one thing on his mind—revenge.', + index: 2, + parentIndex: 1, + viewCount: 11, + lastViewedAt: 1705646565, + parentYear: 2022, + thumb: "/library/metadata/66488/thumb/1703065033", + art: "/library/metadata/30072/art/1705739923", + parentThumb: "/library/metadata/30072/thumb/1705739923", + parentTheme: "/library/metadata/30072/theme/1705739923", + leafCount: 8, + viewedLeafCount: 8, + addedAt: 1702602021, + updatedAt: 1703065033, + userRating: 9, + skipCount: 1, + lastRatedAt: 1703881224, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getmetadatacountry.md b/docs/models/getmetadatacountry.md index e6546dfe..8981acde 100644 --- a/docs/models/getmetadatacountry.md +++ b/docs/models/getmetadatacountry.md @@ -1,5 +1,16 @@ # GetMetadataCountry +## Example Usage + +```typescript +import { GetMetadataCountry } from "@lukehagar/plexjs"; + +let value: GetMetadataCountry = { + id: 116, + filter: "country=116", + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/getmetadatadirector.md b/docs/models/getmetadatadirector.md index 5ffecd22..06ae3048 100644 --- a/docs/models/getmetadatadirector.md +++ b/docs/models/getmetadatadirector.md @@ -1,5 +1,18 @@ # GetMetadataDirector +## Example Usage + +```typescript +import { GetMetadataDirector } from "@lukehagar/plexjs"; + +let value: GetMetadataDirector = { + id: 130, + filter: "director=130", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", +}; +``` ## Fields diff --git a/docs/models/getmetadataerrors.md b/docs/models/getmetadataerrors.md index 566d6b35..8318d333 100644 --- a/docs/models/getmetadataerrors.md +++ b/docs/models/getmetadataerrors.md @@ -1,5 +1,16 @@ # GetMetadataErrors +## Example Usage + +```typescript +import { GetMetadataErrors } from "@lukehagar/plexjs"; + +let value: GetMetadataErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getmetadatagenre.md b/docs/models/getmetadatagenre.md index 5ee9223e..47775608 100644 --- a/docs/models/getmetadatagenre.md +++ b/docs/models/getmetadatagenre.md @@ -1,5 +1,16 @@ # GetMetadataGenre +## Example Usage + +```typescript +import { GetMetadataGenre } from "@lukehagar/plexjs"; + +let value: GetMetadataGenre = { + id: 184, + filter: "genre=184", + tag: "Thriller", +}; +``` ## Fields diff --git a/docs/models/getmetadatalibraryresponsebody.md b/docs/models/getmetadatalibraryresponsebody.md index a16d39d3..a566e547 100644 --- a/docs/models/getmetadatalibraryresponsebody.md +++ b/docs/models/getmetadatalibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetMetadataLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getmetadatamedia.md b/docs/models/getmetadatamedia.md index 220f29a7..7bd55a9b 100644 --- a/docs/models/getmetadatamedia.md +++ b/docs/models/getmetadatamedia.md @@ -1,5 +1,79 @@ # GetMetadataMedia +## Example Usage + +```typescript +import { GetMetadataMedia } from "@lukehagar/plexjs"; + +let value: GetMetadataMedia = { + id: 15, + duration: 141417, + bitrate: 2278, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141417, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + stream: [ + { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getmetadatamediacontainer.md b/docs/models/getmetadatamediacontainer.md index 046d0333..11922193 100644 --- a/docs/models/getmetadatamediacontainer.md +++ b/docs/models/getmetadatamediacontainer.md @@ -1,5 +1,184 @@ # GetMetadataMediaContainer +## Example Usage + +```typescript +import { GetMetadataMediaContainer } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetMetadataMediaContainer = { + size: 1, + allowSync: true, + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "cfc899d7-3000-46f6-8489-b9592714ada5", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141417, + bitrate: 2278, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141417, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + stream: [ + { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, + }, + ], + }, + ], + }, + ], + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + ratings: [ + { + image: "themoviedb://image.rating", + value: 7.4, + type: "audience", + }, + ], + director: [ + { + id: 130, + filter: "director=130", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + writer: [ + { + id: 132, + filter: "writer=132", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + producer: [ + { + id: 221, + filter: "producer=221", + tag: "Barry Mendel", + tagKey: "5d776826961905001eb90e2b", + thumb: "https://metadata-static.plex.tv/8/people/87877371326a964634d18556d94547e1.jpg", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getmetadatametadata.md b/docs/models/getmetadatametadata.md index 90bb57e0..18616a5c 100644 --- a/docs/models/getmetadatametadata.md +++ b/docs/models/getmetadatametadata.md @@ -1,5 +1,172 @@ # GetMetadataMetadata +## Example Usage + +```typescript +import { GetMetadataMetadata } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetMetadataMetadata = { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141417, + bitrate: 2278, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141417, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + stream: [ + { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, + }, + ], + }, + ], + }, + ], + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + ratings: [ + { + image: "themoviedb://image.rating", + value: 7.4, + type: "audience", + }, + ], + director: [ + { + id: 130, + filter: "director=130", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + writer: [ + { + id: 132, + filter: "writer=132", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + producer: [ + { + id: 221, + filter: "producer=221", + tag: "Barry Mendel", + tagKey: "5d776826961905001eb90e2b", + thumb: "https://metadata-static.plex.tv/8/people/87877371326a964634d18556d94547e1.jpg", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getmetadatapart.md b/docs/models/getmetadatapart.md index 02b063f3..f72760c3 100644 --- a/docs/models/getmetadatapart.md +++ b/docs/models/getmetadatapart.md @@ -1,5 +1,59 @@ # GetMetadataPart +## Example Usage + +```typescript +import { GetMetadataPart } from "@lukehagar/plexjs"; + +let value: GetMetadataPart = { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141417, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + stream: [ + { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getmetadatarequest.md b/docs/models/getmetadatarequest.md index 99b24b48..7fea4cf4 100644 --- a/docs/models/getmetadatarequest.md +++ b/docs/models/getmetadatarequest.md @@ -1,5 +1,14 @@ # GetMetadataRequest +## Example Usage + +```typescript +import { GetMetadataRequest } from "@lukehagar/plexjs"; + +let value: GetMetadataRequest = { + ratingKey: 6169.34, +}; +``` ## Fields diff --git a/docs/models/getmetadataresponse.md b/docs/models/getmetadataresponse.md index d5455cf7..3ef9b4d9 100644 --- a/docs/models/getmetadataresponse.md +++ b/docs/models/getmetadataresponse.md @@ -1,5 +1,193 @@ # GetMetadataResponse +## Example Usage + +```typescript +import { GetMetadataResponse } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetMetadataResponse = { + contentType: "", + statusCode: 386489, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + allowSync: true, + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "cfc899d7-3000-46f6-8489-b9592714ada5", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141417, + bitrate: 2278, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141417, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + stream: [ + { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, + }, + ], + }, + ], + }, + ], + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + ratings: [ + { + image: "themoviedb://image.rating", + value: 7.4, + type: "audience", + }, + ], + director: [ + { + id: 130, + filter: "director=130", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + writer: [ + { + id: 132, + filter: "writer=132", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + producer: [ + { + id: 221, + filter: "producer=221", + tag: "Barry Mendel", + tagKey: "5d776826961905001eb90e2b", + thumb: "https://metadata-static.plex.tv/8/people/87877371326a964634d18556d94547e1.jpg", + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getmetadataresponsebody.md b/docs/models/getmetadataresponsebody.md index fd0abb03..0c9877e1 100644 --- a/docs/models/getmetadataresponsebody.md +++ b/docs/models/getmetadataresponsebody.md @@ -2,6 +2,187 @@ The metadata of the library item. +## Example Usage + +```typescript +import { GetMetadataResponseBody } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetMetadataResponseBody = { + mediaContainer: { + size: 1, + allowSync: true, + identifier: "com.plexapp.plugins.library", + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "cfc899d7-3000-46f6-8489-b9592714ada5", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141417, + bitrate: 2278, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141417, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + stream: [ + { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, + }, + ], + }, + ], + }, + ], + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + ratings: [ + { + image: "themoviedb://image.rating", + value: 7.4, + type: "audience", + }, + ], + director: [ + { + id: 130, + filter: "director=130", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + writer: [ + { + id: 132, + filter: "writer=132", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + producer: [ + { + id: 221, + filter: "producer=221", + tag: "Barry Mendel", + tagKey: "5d776826961905001eb90e2b", + thumb: "https://metadata-static.plex.tv/8/people/87877371326a964634d18556d94547e1.jpg", + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getmetadatarole.md b/docs/models/getmetadatarole.md index ec3e8979..16052562 100644 --- a/docs/models/getmetadatarole.md +++ b/docs/models/getmetadatarole.md @@ -1,5 +1,19 @@ # GetMetadataRole +## Example Usage + +```typescript +import { GetMetadataRole } from "@lukehagar/plexjs"; + +let value: GetMetadataRole = { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", +}; +``` ## Fields diff --git a/docs/models/getmetadatawriter.md b/docs/models/getmetadatawriter.md index 82a18b8f..d77ed800 100644 --- a/docs/models/getmetadatawriter.md +++ b/docs/models/getmetadatawriter.md @@ -1,5 +1,18 @@ # GetMetadataWriter +## Example Usage + +```typescript +import { GetMetadataWriter } from "@lukehagar/plexjs"; + +let value: GetMetadataWriter = { + id: 132, + filter: "writer=132", + tag: "Joss Whedon", + tagKey: "5d776828880197001ec90e8f", + thumb: "https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg", +}; +``` ## Fields diff --git a/docs/models/getmyplexaccounterrors.md b/docs/models/getmyplexaccounterrors.md index 2a631363..635f3ca0 100644 --- a/docs/models/getmyplexaccounterrors.md +++ b/docs/models/getmyplexaccounterrors.md @@ -1,5 +1,16 @@ # GetMyPlexAccountErrors +## Example Usage + +```typescript +import { GetMyPlexAccountErrors } from "@lukehagar/plexjs"; + +let value: GetMyPlexAccountErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getmyplexaccountresponse.md b/docs/models/getmyplexaccountresponse.md index 25b7bb91..1eaedf17 100644 --- a/docs/models/getmyplexaccountresponse.md +++ b/docs/models/getmyplexaccountresponse.md @@ -1,5 +1,33 @@ # GetMyPlexAccountResponse +## Example Usage + +```typescript +import { GetMyPlexAccountResponse } from "@lukehagar/plexjs"; + +let value: GetMyPlexAccountResponse = { + contentType: "", + statusCode: 857946, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + myPlex: { + authToken: "Z5v-PrNASDFpsaCi3CPK7", + username: "example.email@mail.com", + mappingState: "mapped", + signInState: "ok", + publicAddress: "140.20.68.140", + publicPort: 32400, + privateAddress: "10.10.10.47", + privatePort: 32400, + subscriptionFeatures: + "federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks", + subscriptionState: "Active", + }, + }, +}; +``` ## Fields diff --git a/docs/models/getmyplexaccountresponsebody.md b/docs/models/getmyplexaccountresponsebody.md index 420d7d85..564b154c 100644 --- a/docs/models/getmyplexaccountresponsebody.md +++ b/docs/models/getmyplexaccountresponsebody.md @@ -2,6 +2,27 @@ MyPlex Account +## Example Usage + +```typescript +import { GetMyPlexAccountResponseBody } from "@lukehagar/plexjs"; + +let value: GetMyPlexAccountResponseBody = { + myPlex: { + authToken: "Z5v-PrNASDFpsaCi3CPK7", + username: "example.email@mail.com", + mappingState: "mapped", + signInState: "ok", + publicAddress: "140.20.68.140", + publicPort: 32400, + privateAddress: "10.10.10.47", + privatePort: 32400, + subscriptionFeatures: + "federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks", + subscriptionState: "Active", + }, +}; +``` ## Fields diff --git a/docs/models/getmyplexaccountserverresponsebody.md b/docs/models/getmyplexaccountserverresponsebody.md index 4a014b07..1e8bcf18 100644 --- a/docs/models/getmyplexaccountserverresponsebody.md +++ b/docs/models/getmyplexaccountserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetMyPlexAccountServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getondeckerrors.md b/docs/models/getondeckerrors.md index d6e1519e..28a82f6e 100644 --- a/docs/models/getondeckerrors.md +++ b/docs/models/getondeckerrors.md @@ -1,5 +1,16 @@ # GetOnDeckErrors +## Example Usage + +```typescript +import { GetOnDeckErrors } from "@lukehagar/plexjs"; + +let value: GetOnDeckErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getondeckguids.md b/docs/models/getondeckguids.md index 7cfd4101..0d31fb1c 100644 --- a/docs/models/getondeckguids.md +++ b/docs/models/getondeckguids.md @@ -1,5 +1,14 @@ # GetOnDeckGuids +## Example Usage + +```typescript +import { GetOnDeckGuids } from "@lukehagar/plexjs"; + +let value: GetOnDeckGuids = { + id: "imdb://tt13303712", +}; +``` ## Fields diff --git a/docs/models/getondecklibraryresponsebody.md b/docs/models/getondecklibraryresponsebody.md index 734bb4ea..e650628a 100644 --- a/docs/models/getondecklibraryresponsebody.md +++ b/docs/models/getondecklibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetOnDeckLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getondeckmedia.md b/docs/models/getondeckmedia.md index fd2f3c4e..6eb6a6d4 100644 --- a/docs/models/getondeckmedia.md +++ b/docs/models/getondeckmedia.md @@ -1,5 +1,65 @@ # GetOnDeckMedia +## Example Usage + +```typescript +import { GetOnDeckMedia } from "@lukehagar/plexjs"; + +let value: GetOnDeckMedia = { + id: 80994, + duration: 420080, + bitrate: 1046, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: "1080", + container: "mkv", + videoFrameRate: "PAL", + audioProfile: "lc", + videoProfile: "main", + part: [ + { + id: 80994, + key: "/library/parts/80994/1655007810/file.mkv", + duration: 420080, + file: "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv", + size: 55148931, + audioProfile: "lc", + container: "mkv", + videoProfile: "main", + stream: [ + { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getondeckmediacontainer.md b/docs/models/getondeckmediacontainer.md index 22a2ba96..1acf8144 100644 --- a/docs/models/getondeckmediacontainer.md +++ b/docs/models/getondeckmediacontainer.md @@ -1,5 +1,116 @@ # GetOnDeckMediaContainer +## Example Usage + +```typescript +import { GetOnDeckMediaContainer } from "@lukehagar/plexjs"; + +let value: GetOnDeckMediaContainer = { + size: 16, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + ratingKey: 49564, + key: "/library/metadata/49564", + parentRatingKey: 49557, + grandparentRatingKey: 49556, + guid: "plex://episode/5ea7d7402e7ab10042e74d4f", + parentGuid: "plex://season/602e754d67f4c8002ce54b3d", + grandparentGuid: "plex://show/5d9c090e705e7a001e6e94d8", + type: "episode", + title: "Circus", + grandparentKey: "/library/metadata/49556", + parentKey: "/library/metadata/49557", + librarySectionKey: "/library/sections/2", + grandparentTitle: "Bluey (2018)", + parentTitle: "Season 2", + contentRating: "TV-Y", + summary: + "Bluey is the ringmaster in a game of circus with her friends but Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution to keep everyone happy.", + index: 33, + parentIndex: 2, + lastViewedAt: 1681908352, + year: 2018, + thumb: "/library/metadata/49564/thumb/1654258204", + art: "/library/metadata/49556/art/1680939546", + parentThumb: "/library/metadata/49557/thumb/1654258204", + grandparentThumb: "/library/metadata/49556/thumb/1680939546", + grandparentArt: "/library/metadata/49556/art/1680939546", + grandparentTheme: "/library/metadata/49556/theme/1680939546", + duration: 420080, + originallyAvailableAt: new Date("2020-10-31T00:00:00Z"), + addedAt: 1654258196, + updatedAt: 1654258204, + media: [ + { + id: 80994, + duration: 420080, + bitrate: 1046, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: "1080", + container: "mkv", + videoFrameRate: "PAL", + audioProfile: "lc", + videoProfile: "main", + part: [ + { + id: 80994, + key: "/library/parts/80994/1655007810/file.mkv", + duration: 420080, + file: "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv", + size: 55148931, + audioProfile: "lc", + container: "mkv", + videoProfile: "main", + stream: [ + { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", + }, + ], + }, + ], + }, + ], + guids: [ + { + id: "imdb://tt13303712", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getondeckmetadata.md b/docs/models/getondeckmetadata.md index 314bc546..6a8ebb67 100644 --- a/docs/models/getondeckmetadata.md +++ b/docs/models/getondeckmetadata.md @@ -1,5 +1,108 @@ # GetOnDeckMetadata +## Example Usage + +```typescript +import { GetOnDeckMetadata } from "@lukehagar/plexjs"; + +let value: GetOnDeckMetadata = { + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + ratingKey: 49564, + key: "/library/metadata/49564", + parentRatingKey: 49557, + grandparentRatingKey: 49556, + guid: "plex://episode/5ea7d7402e7ab10042e74d4f", + parentGuid: "plex://season/602e754d67f4c8002ce54b3d", + grandparentGuid: "plex://show/5d9c090e705e7a001e6e94d8", + type: "episode", + title: "Circus", + grandparentKey: "/library/metadata/49556", + parentKey: "/library/metadata/49557", + librarySectionKey: "/library/sections/2", + grandparentTitle: "Bluey (2018)", + parentTitle: "Season 2", + contentRating: "TV-Y", + summary: + "Bluey is the ringmaster in a game of circus with her friends but Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution to keep everyone happy.", + index: 33, + parentIndex: 2, + lastViewedAt: 1681908352, + year: 2018, + thumb: "/library/metadata/49564/thumb/1654258204", + art: "/library/metadata/49556/art/1680939546", + parentThumb: "/library/metadata/49557/thumb/1654258204", + grandparentThumb: "/library/metadata/49556/thumb/1680939546", + grandparentArt: "/library/metadata/49556/art/1680939546", + grandparentTheme: "/library/metadata/49556/theme/1680939546", + duration: 420080, + originallyAvailableAt: new Date("2020-10-31T00:00:00Z"), + addedAt: 1654258196, + updatedAt: 1654258204, + media: [ + { + id: 80994, + duration: 420080, + bitrate: 1046, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: "1080", + container: "mkv", + videoFrameRate: "PAL", + audioProfile: "lc", + videoProfile: "main", + part: [ + { + id: 80994, + key: "/library/parts/80994/1655007810/file.mkv", + duration: 420080, + file: "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv", + size: 55148931, + audioProfile: "lc", + container: "mkv", + videoProfile: "main", + stream: [ + { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", + }, + ], + }, + ], + }, + ], + guids: [ + { + id: "imdb://tt13303712", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getondeckpart.md b/docs/models/getondeckpart.md index 5ee6e0fe..caf7815c 100644 --- a/docs/models/getondeckpart.md +++ b/docs/models/getondeckpart.md @@ -1,5 +1,47 @@ # GetOnDeckPart +## Example Usage + +```typescript +import { GetOnDeckPart } from "@lukehagar/plexjs"; + +let value: GetOnDeckPart = { + id: 80994, + key: "/library/parts/80994/1655007810/file.mkv", + duration: 420080, + file: "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv", + size: 55148931, + audioProfile: "lc", + container: "mkv", + videoProfile: "main", + stream: [ + { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getondeckresponse.md b/docs/models/getondeckresponse.md index 50e4dcea..8abf9446 100644 --- a/docs/models/getondeckresponse.md +++ b/docs/models/getondeckresponse.md @@ -1,5 +1,125 @@ # GetOnDeckResponse +## Example Usage + +```typescript +import { GetOnDeckResponse } from "@lukehagar/plexjs"; + +let value: GetOnDeckResponse = { + contentType: "", + statusCode: 359508, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 16, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + ratingKey: 49564, + key: "/library/metadata/49564", + parentRatingKey: 49557, + grandparentRatingKey: 49556, + guid: "plex://episode/5ea7d7402e7ab10042e74d4f", + parentGuid: "plex://season/602e754d67f4c8002ce54b3d", + grandparentGuid: "plex://show/5d9c090e705e7a001e6e94d8", + type: "episode", + title: "Circus", + grandparentKey: "/library/metadata/49556", + parentKey: "/library/metadata/49557", + librarySectionKey: "/library/sections/2", + grandparentTitle: "Bluey (2018)", + parentTitle: "Season 2", + contentRating: "TV-Y", + summary: + "Bluey is the ringmaster in a game of circus with her friends but Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution to keep everyone happy.", + index: 33, + parentIndex: 2, + lastViewedAt: 1681908352, + year: 2018, + thumb: "/library/metadata/49564/thumb/1654258204", + art: "/library/metadata/49556/art/1680939546", + parentThumb: "/library/metadata/49557/thumb/1654258204", + grandparentThumb: "/library/metadata/49556/thumb/1680939546", + grandparentArt: "/library/metadata/49556/art/1680939546", + grandparentTheme: "/library/metadata/49556/theme/1680939546", + duration: 420080, + originallyAvailableAt: new Date("2020-10-31T00:00:00Z"), + addedAt: 1654258196, + updatedAt: 1654258204, + media: [ + { + id: 80994, + duration: 420080, + bitrate: 1046, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: "1080", + container: "mkv", + videoFrameRate: "PAL", + audioProfile: "lc", + videoProfile: "main", + part: [ + { + id: 80994, + key: "/library/parts/80994/1655007810/file.mkv", + duration: 420080, + file: "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv", + size: 55148931, + audioProfile: "lc", + container: "mkv", + videoProfile: "main", + stream: [ + { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", + }, + ], + }, + ], + }, + ], + guids: [ + { + id: "imdb://tt13303712", + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getondeckresponsebody.md b/docs/models/getondeckresponsebody.md index 88e09e02..bf7ae871 100644 --- a/docs/models/getondeckresponsebody.md +++ b/docs/models/getondeckresponsebody.md @@ -2,6 +2,119 @@ The on Deck content +## Example Usage + +```typescript +import { GetOnDeckResponseBody } from "@lukehagar/plexjs"; + +let value: GetOnDeckResponseBody = { + mediaContainer: { + size: 16, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 2, + librarySectionTitle: "TV Shows", + librarySectionUUID: "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", + ratingKey: 49564, + key: "/library/metadata/49564", + parentRatingKey: 49557, + grandparentRatingKey: 49556, + guid: "plex://episode/5ea7d7402e7ab10042e74d4f", + parentGuid: "plex://season/602e754d67f4c8002ce54b3d", + grandparentGuid: "plex://show/5d9c090e705e7a001e6e94d8", + type: "episode", + title: "Circus", + grandparentKey: "/library/metadata/49556", + parentKey: "/library/metadata/49557", + librarySectionKey: "/library/sections/2", + grandparentTitle: "Bluey (2018)", + parentTitle: "Season 2", + contentRating: "TV-Y", + summary: + "Bluey is the ringmaster in a game of circus with her friends but Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution to keep everyone happy.", + index: 33, + parentIndex: 2, + lastViewedAt: 1681908352, + year: 2018, + thumb: "/library/metadata/49564/thumb/1654258204", + art: "/library/metadata/49556/art/1680939546", + parentThumb: "/library/metadata/49557/thumb/1654258204", + grandparentThumb: "/library/metadata/49556/thumb/1680939546", + grandparentArt: "/library/metadata/49556/art/1680939546", + grandparentTheme: "/library/metadata/49556/theme/1680939546", + duration: 420080, + originallyAvailableAt: new Date("2020-10-31T00:00:00Z"), + addedAt: 1654258196, + updatedAt: 1654258204, + media: [ + { + id: 80994, + duration: 420080, + bitrate: 1046, + width: 1920, + height: 1080, + aspectRatio: 1.78, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: "1080", + container: "mkv", + videoFrameRate: "PAL", + audioProfile: "lc", + videoProfile: "main", + part: [ + { + id: 80994, + key: "/library/parts/80994/1655007810/file.mkv", + duration: 420080, + file: "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv", + size: 55148931, + audioProfile: "lc", + container: "mkv", + videoProfile: "main", + stream: [ + { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", + }, + ], + }, + ], + }, + ], + guids: [ + { + id: "imdb://tt13303712", + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getondeckstream.md b/docs/models/getondeckstream.md index 93f97399..90f28570 100644 --- a/docs/models/getondeckstream.md +++ b/docs/models/getondeckstream.md @@ -1,5 +1,35 @@ # GetOnDeckStream +## Example Usage + +```typescript +import { GetOnDeckStream } from "@lukehagar/plexjs"; + +let value: GetOnDeckStream = { + id: 211234, + streamType: 1, + codec: "hevc", + index: 0, + bitrate: 918, + language: "English", + languageTag: "en", + languageCode: "eng", + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "4:2:0", + codedHeight: 1080, + codedWidth: 1920, + colorRange: "tv", + frameRate: 25, + height: 1080, + level: 120, + profile: "main", + refFrames: 1, + width: 1920, + displayTitle: "1080p (HEVC Main)", + extendedDisplayTitle: "1080p (HEVC Main)", +}; +``` ## Fields diff --git a/docs/models/getpinauthpincontainer.md b/docs/models/getpinauthpincontainer.md new file mode 100644 index 00000000..39025cec --- /dev/null +++ b/docs/models/getpinauthpincontainer.md @@ -0,0 +1,53 @@ +# GetPinAuthPinContainer + +Requests a new pin id used in the authentication flow + +## Example Usage + +```typescript +import { GetPinAuthPinContainer } from "@lukehagar/plexjs"; + +let value: GetPinAuthPinContainer = { + id: 308667304, + code: "7RQZ", + product: "0", + trusted: false, + qr: "https://plex.tv/api/v2/pins/qr/7RQZ", + clientIdentifier: "string", + location: { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", + }, + expiresIn: 876, + createdAt: new Date("2024-07-16T17:03:05Z"), + expiresAt: new Date("2024-07-16T17:18:05Z"), + authToken: null, + newRegistration: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *number* | :heavy_check_mark: | N/A | 308667304 | +| `code` | *string* | :heavy_check_mark: | N/A | 7RQZ | +| `product` | *string* | :heavy_check_mark: | N/A | 0 | +| `trusted` | *boolean* | :heavy_minus_sign: | N/A | | +| `qr` | *string* | :heavy_check_mark: | N/A | https://plex.tv/api/v2/pins/qr/7RQZ | +| `clientIdentifier` | *string* | :heavy_check_mark: | The X-Client-Identifier used in the request | | +| `location` | [models.GeoData](../models/geodata.md) | :heavy_check_mark: | Geo location data | {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
} | +| `expiresIn` | *number* | :heavy_minus_sign: | The number of seconds this pin expires, by default 900 seconds | 876 | +| `createdAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-07-16T17:03:05Z | +| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-07-16T17:18:05Z | +| `authToken` | *any* | :heavy_minus_sign: | N/A | | +| `newRegistration` | *any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/getpinerrors.md b/docs/models/getpinerrors.md index d62b1d72..df3ee917 100644 --- a/docs/models/getpinerrors.md +++ b/docs/models/getpinerrors.md @@ -1,5 +1,16 @@ # GetPinErrors +## Example Usage + +```typescript +import { GetPinErrors } from "@lukehagar/plexjs"; + +let value: GetPinErrors = { + code: 1000, + message: "X-Plex-Client-Identifier is missing", + status: 400, +}; +``` ## Fields diff --git a/docs/models/getpinglobals.md b/docs/models/getpinglobals.md index 556fa77c..e7b7670e 100644 --- a/docs/models/getpinglobals.md +++ b/docs/models/getpinglobals.md @@ -1,5 +1,12 @@ # GetPinGlobals +## Example Usage + +```typescript +import { GetPinGlobals } from "@lukehagar/plexjs"; + +let value: GetPinGlobals = {}; +``` ## Fields diff --git a/docs/models/getpinrequest.md b/docs/models/getpinrequest.md index faa89a7e..8d83a8d7 100644 --- a/docs/models/getpinrequest.md +++ b/docs/models/getpinrequest.md @@ -1,5 +1,14 @@ # GetPinRequest +## Example Usage + +```typescript +import { GetPinRequest } from "@lukehagar/plexjs"; + +let value: GetPinRequest = { + xPlexProduct: "Postman", +}; +``` ## Fields diff --git a/docs/models/getpinresponse.md b/docs/models/getpinresponse.md index 80427b97..0a5b0e3f 100644 --- a/docs/models/getpinresponse.md +++ b/docs/models/getpinresponse.md @@ -1,11 +1,50 @@ # GetPinResponse +## Example Usage + +```typescript +import { GetPinResponse } from "@lukehagar/plexjs"; + +let value: GetPinResponse = { + contentType: "", + statusCode: 799159, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + authPinContainer: { + id: 308667304, + code: "7RQZ", + product: "0", + trusted: false, + qr: "https://plex.tv/api/v2/pins/qr/7RQZ", + clientIdentifier: "string", + location: { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", + }, + expiresIn: 876, + createdAt: new Date("2024-07-16T17:03:05Z"), + expiresAt: new Date("2024-07-16T17:18:05Z"), + authToken: null, + newRegistration: null, + }, +}; +``` ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `object` | [models.GetPinResponseBody](../models/getpinresponsebody.md) | :heavy_minus_sign: | The Pin | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `authPinContainer` | [models.GetPinAuthPinContainer](../models/getpinauthpincontainer.md) | :heavy_minus_sign: | Requests a new pin id used in the authentication flow | {
"id": 308667304,
"code": "7RQZ",
"product": "0",
"trusted": false,
"qr": "https://plex.tv/api/v2/pins/qr/7RQZ",
"clientIdentifier": "string",
"location": {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
},
"expiresIn": 876,
"createdAt": "2024-07-16T17:03:05Z",
"expiresAt": "2024-07-16T17:18:05Z",
"authToken": null,
"newRegistration": null
} | \ No newline at end of file diff --git a/docs/models/getpinresponsebody.md b/docs/models/getpinresponsebody.md index 055a911b..ce5b469c 100644 --- a/docs/models/getpinresponsebody.md +++ b/docs/models/getpinresponsebody.md @@ -1,21 +1,18 @@ # GetPinResponseBody -The Pin +Bad Request response when the X-Plex-Client-Identifier is missing +## Example Usage + +```typescript +import { GetPinResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *number* | :heavy_minus_sign: | PinID for use with authentication | 1272322473 | -| `code` | *string* | :heavy_minus_sign: | N/A | 3patfx1a78ukcbr7x0n9bl26t | -| `product` | *string* | :heavy_minus_sign: | N/A | Plex Web | -| `trusted` | *boolean* | :heavy_minus_sign: | N/A | | -| `qr` | *string* | :heavy_minus_sign: | a link to a QR code hosted on plex.tv
The QR code redirects to the relevant `plex.tv/link` authentication page
Which then prompts the user for the 4 Digit Link Pin
| https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t | -| `clientIdentifier` | *string* | :heavy_minus_sign: | N/A | Postman | -| `location` | [models.Location](../models/location.md) | :heavy_minus_sign: | N/A | | -| `expiresIn` | *number* | :heavy_minus_sign: | N/A | 1800 | -| `createdAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | N/A | 2023-04-12 17:00:03 +0000 UTC | -| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | N/A | 2023-04-12 17:30:03 +0000 UTC | -| `authToken` | *string* | :heavy_minus_sign: | N/A | | -| `newRegistration` | *boolean* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `errors` | [models.GetPinErrors](../models/getpinerrors.md)[] | :heavy_minus_sign: | N/A | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/getplaylistcontentscountry.md b/docs/models/getplaylistcontentscountry.md index f8622ecf..01285d0f 100644 --- a/docs/models/getplaylistcontentscountry.md +++ b/docs/models/getplaylistcontentscountry.md @@ -1,5 +1,14 @@ # GetPlaylistContentsCountry +## Example Usage + +```typescript +import { GetPlaylistContentsCountry } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsCountry = { + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsdirector.md b/docs/models/getplaylistcontentsdirector.md index 6de150e8..7ce2d21f 100644 --- a/docs/models/getplaylistcontentsdirector.md +++ b/docs/models/getplaylistcontentsdirector.md @@ -1,5 +1,14 @@ # GetPlaylistContentsDirector +## Example Usage + +```typescript +import { GetPlaylistContentsDirector } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsDirector = { + tag: "Joss Whedon", +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentserrors.md b/docs/models/getplaylistcontentserrors.md index 73363b9e..18351160 100644 --- a/docs/models/getplaylistcontentserrors.md +++ b/docs/models/getplaylistcontentserrors.md @@ -1,5 +1,16 @@ # GetPlaylistContentsErrors +## Example Usage + +```typescript +import { GetPlaylistContentsErrors } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsgenre.md b/docs/models/getplaylistcontentsgenre.md index 1b493fb7..1b859d6d 100644 --- a/docs/models/getplaylistcontentsgenre.md +++ b/docs/models/getplaylistcontentsgenre.md @@ -1,5 +1,14 @@ # GetPlaylistContentsGenre +## Example Usage + +```typescript +import { GetPlaylistContentsGenre } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsGenre = { + tag: "Action", +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsmedia.md b/docs/models/getplaylistcontentsmedia.md index 497b8e96..652806da 100644 --- a/docs/models/getplaylistcontentsmedia.md +++ b/docs/models/getplaylistcontentsmedia.md @@ -1,5 +1,43 @@ # GetPlaylistContentsMedia +## Example Usage + +```typescript +import { GetPlaylistContentsMedia } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsMedia = { + id: 15, + duration: 141416, + bitrate: 2273, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141416, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsmediacontainer.md b/docs/models/getplaylistcontentsmediacontainer.md index f283eef5..c62aa23b 100644 --- a/docs/models/getplaylistcontentsmediacontainer.md +++ b/docs/models/getplaylistcontentsmediacontainer.md @@ -1,5 +1,112 @@ # GetPlaylistContentsMediaContainer +## Example Usage + +```typescript +import { GetPlaylistContentsMediaContainer } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetPlaylistContentsMediaContainer = { + size: 2, + composite: "/playlists/95/composite/1705717521", + duration: 282, + leafCount: 2, + playlistType: "video", + ratingKey: "95", + smart: true, + title: "Smart Movie Playlist", + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + titleSort: "Amazing Spider-Man 2", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141416, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141416, + bitrate: 2273, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141416, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Joss Whedon", + }, + ], + writer: [ + { + tag: "Joss Whedon", + }, + ], + role: [ + { + tag: "Gina Torres", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsmetadata.md b/docs/models/getplaylistcontentsmetadata.md index e78b9e62..8993eaf9 100644 --- a/docs/models/getplaylistcontentsmetadata.md +++ b/docs/models/getplaylistcontentsmetadata.md @@ -1,5 +1,100 @@ # GetPlaylistContentsMetadata +## Example Usage + +```typescript +import { GetPlaylistContentsMetadata } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetPlaylistContentsMetadata = { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + titleSort: "Amazing Spider-Man 2", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141416, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141416, + bitrate: 2273, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141416, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Joss Whedon", + }, + ], + writer: [ + { + tag: "Joss Whedon", + }, + ], + role: [ + { + tag: "Gina Torres", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentspart.md b/docs/models/getplaylistcontentspart.md index 34e99b7c..5bacaef4 100644 --- a/docs/models/getplaylistcontentspart.md +++ b/docs/models/getplaylistcontentspart.md @@ -1,5 +1,23 @@ # GetPlaylistContentsPart +## Example Usage + +```typescript +import { GetPlaylistContentsPart } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsPart = { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141416, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsplaylistsresponsebody.md b/docs/models/getplaylistcontentsplaylistsresponsebody.md index 0d33ee2c..e7652629 100644 --- a/docs/models/getplaylistcontentsplaylistsresponsebody.md +++ b/docs/models/getplaylistcontentsplaylistsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetPlaylistContentsPlaylistsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getplaylistcontentsrequest.md b/docs/models/getplaylistcontentsrequest.md index 70736992..4dd50e64 100644 --- a/docs/models/getplaylistcontentsrequest.md +++ b/docs/models/getplaylistcontentsrequest.md @@ -1,5 +1,15 @@ # GetPlaylistContentsRequest +## Example Usage + +```typescript +import { GetPlaylistContentsRequest } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsRequest = { + playlistID: 9883.74, + type: 9589.5, +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsresponse.md b/docs/models/getplaylistcontentsresponse.md index d3a2f9a4..6a560fed 100644 --- a/docs/models/getplaylistcontentsresponse.md +++ b/docs/models/getplaylistcontentsresponse.md @@ -1,5 +1,121 @@ # GetPlaylistContentsResponse +## Example Usage + +```typescript +import { GetPlaylistContentsResponse } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetPlaylistContentsResponse = { + contentType: "", + statusCode: 102044, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 2, + composite: "/playlists/95/composite/1705717521", + duration: 282, + leafCount: 2, + playlistType: "video", + ratingKey: "95", + smart: true, + title: "Smart Movie Playlist", + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + titleSort: "Amazing Spider-Man 2", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141416, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141416, + bitrate: 2273, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141416, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Joss Whedon", + }, + ], + writer: [ + { + tag: "Joss Whedon", + }, + ], + role: [ + { + tag: "Gina Torres", + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsresponsebody.md b/docs/models/getplaylistcontentsresponsebody.md index 200073d9..ae796769 100644 --- a/docs/models/getplaylistcontentsresponsebody.md +++ b/docs/models/getplaylistcontentsresponsebody.md @@ -2,6 +2,115 @@ The playlist contents +## Example Usage + +```typescript +import { GetPlaylistContentsResponseBody } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetPlaylistContentsResponseBody = { + mediaContainer: { + size: 2, + composite: "/playlists/95/composite/1705717521", + duration: 282, + leafCount: 2, + playlistType: "video", + ratingKey: "95", + smart: true, + title: "Smart Movie Playlist", + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + titleSort: "Amazing Spider-Man 2", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + rating: 8.2, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141416, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + addedAt: 1705637164, + updatedAt: 1705637165, + audienceRatingImage: "rottentomatoes://image.rating.upright", + hasPremiumExtras: "1", + hasPremiumPrimaryExtra: "1", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 15, + duration: 141416, + bitrate: 2273, + width: 1920, + height: 814, + aspectRatio: 2.35, + audioChannels: 2, + audioCodec: "aac", + videoCodec: "h264", + videoResolution: "1080", + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + audioProfile: "lc", + has64bitOffsets: false, + videoProfile: "high", + part: [ + { + id: 15, + key: "/library/parts/15/1705637151/file.mp4", + duration: 141416, + file: "/movies/Serenity (2005)/Serenity (2005).mp4", + size: 40271948, + audioProfile: "lc", + container: "mp4", + has64bitOffsets: false, + optimizedForStreaming: false, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + director: [ + { + tag: "Joss Whedon", + }, + ], + writer: [ + { + tag: "Joss Whedon", + }, + ], + role: [ + { + tag: "Gina Torres", + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentsrole.md b/docs/models/getplaylistcontentsrole.md index 0338b276..4ad2a796 100644 --- a/docs/models/getplaylistcontentsrole.md +++ b/docs/models/getplaylistcontentsrole.md @@ -1,5 +1,14 @@ # GetPlaylistContentsRole +## Example Usage + +```typescript +import { GetPlaylistContentsRole } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsRole = { + tag: "Gina Torres", +}; +``` ## Fields diff --git a/docs/models/getplaylistcontentswriter.md b/docs/models/getplaylistcontentswriter.md index c222b185..0db4e47a 100644 --- a/docs/models/getplaylistcontentswriter.md +++ b/docs/models/getplaylistcontentswriter.md @@ -1,5 +1,14 @@ # GetPlaylistContentsWriter +## Example Usage + +```typescript +import { GetPlaylistContentsWriter } from "@lukehagar/plexjs"; + +let value: GetPlaylistContentsWriter = { + tag: "Joss Whedon", +}; +``` ## Fields diff --git a/docs/models/getplaylisterrors.md b/docs/models/getplaylisterrors.md index b0cd8162..b680f8df 100644 --- a/docs/models/getplaylisterrors.md +++ b/docs/models/getplaylisterrors.md @@ -1,5 +1,16 @@ # GetPlaylistErrors +## Example Usage + +```typescript +import { GetPlaylistErrors } from "@lukehagar/plexjs"; + +let value: GetPlaylistErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getplaylistmediacontainer.md b/docs/models/getplaylistmediacontainer.md index 296634bc..ccfd5856 100644 --- a/docs/models/getplaylistmediacontainer.md +++ b/docs/models/getplaylistmediacontainer.md @@ -1,5 +1,34 @@ # GetPlaylistMediaContainer +## Example Usage + +```typescript +import { GetPlaylistMediaContainer } from "@lukehagar/plexjs"; + +let value: GetPlaylistMediaContainer = { + size: 1, + metadata: [ + { + content: + "library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1", + ratingKey: "95", + key: "/playlists/95/items", + guid: "com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91", + type: "playlist", + title: "Smart Movie Playlist", + summary: "", + smart: true, + playlistType: "video", + composite: "/playlists/95/composite/1705717387", + icon: "playlist://image.smart", + duration: 282000, + leafCount: 2, + addedAt: 1705716493, + updatedAt: 1705717387, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getplaylistmetadata.md b/docs/models/getplaylistmetadata.md index 41deed69..06583ed7 100644 --- a/docs/models/getplaylistmetadata.md +++ b/docs/models/getplaylistmetadata.md @@ -1,5 +1,29 @@ # GetPlaylistMetadata +## Example Usage + +```typescript +import { GetPlaylistMetadata } from "@lukehagar/plexjs"; + +let value: GetPlaylistMetadata = { + content: + "library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1", + ratingKey: "95", + key: "/playlists/95/items", + guid: "com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91", + type: "playlist", + title: "Smart Movie Playlist", + summary: "", + smart: true, + playlistType: "video", + composite: "/playlists/95/composite/1705717387", + icon: "playlist://image.smart", + duration: 282000, + leafCount: 2, + addedAt: 1705716493, + updatedAt: 1705717387, +}; +``` ## Fields diff --git a/docs/models/getplaylistplaylistsresponsebody.md b/docs/models/getplaylistplaylistsresponsebody.md index da2dd985..81b3f001 100644 --- a/docs/models/getplaylistplaylistsresponsebody.md +++ b/docs/models/getplaylistplaylistsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetPlaylistPlaylistsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getplaylistrequest.md b/docs/models/getplaylistrequest.md index 07df8f2f..4e9db0e3 100644 --- a/docs/models/getplaylistrequest.md +++ b/docs/models/getplaylistrequest.md @@ -1,5 +1,14 @@ # GetPlaylistRequest +## Example Usage + +```typescript +import { GetPlaylistRequest } from "@lukehagar/plexjs"; + +let value: GetPlaylistRequest = { + playlistID: 3637.11, +}; +``` ## Fields diff --git a/docs/models/getplaylistresponse.md b/docs/models/getplaylistresponse.md index 87d7fd7a..73be07f7 100644 --- a/docs/models/getplaylistresponse.md +++ b/docs/models/getplaylistresponse.md @@ -1,5 +1,43 @@ # GetPlaylistResponse +## Example Usage + +```typescript +import { GetPlaylistResponse } from "@lukehagar/plexjs"; + +let value: GetPlaylistResponse = { + contentType: "", + statusCode: 325047, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + metadata: [ + { + content: + "library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1", + ratingKey: "95", + key: "/playlists/95/items", + guid: "com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91", + type: "playlist", + title: "Smart Movie Playlist", + summary: "", + smart: true, + playlistType: "video", + composite: "/playlists/95/composite/1705717387", + icon: "playlist://image.smart", + duration: 282000, + leafCount: 2, + addedAt: 1705716493, + updatedAt: 1705717387, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getplaylistresponsebody.md b/docs/models/getplaylistresponsebody.md index cf1efb44..140c0bf7 100644 --- a/docs/models/getplaylistresponsebody.md +++ b/docs/models/getplaylistresponsebody.md @@ -2,6 +2,37 @@ The playlist +## Example Usage + +```typescript +import { GetPlaylistResponseBody } from "@lukehagar/plexjs"; + +let value: GetPlaylistResponseBody = { + mediaContainer: { + size: 1, + metadata: [ + { + content: + "library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1", + ratingKey: "95", + key: "/playlists/95/items", + guid: "com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91", + type: "playlist", + title: "Smart Movie Playlist", + summary: "", + smart: true, + playlistType: "video", + composite: "/playlists/95/composite/1705717387", + icon: "playlist://image.smart", + duration: 282000, + leafCount: 2, + addedAt: 1705716493, + updatedAt: 1705717387, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getplaylistserrors.md b/docs/models/getplaylistserrors.md index 01224be6..500d2e1a 100644 --- a/docs/models/getplaylistserrors.md +++ b/docs/models/getplaylistserrors.md @@ -1,5 +1,16 @@ # GetPlaylistsErrors +## Example Usage + +```typescript +import { GetPlaylistsErrors } from "@lukehagar/plexjs"; + +let value: GetPlaylistsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getplaylistsmediacontainer.md b/docs/models/getplaylistsmediacontainer.md index 672ecc4d..8271a3f8 100644 --- a/docs/models/getplaylistsmediacontainer.md +++ b/docs/models/getplaylistsmediacontainer.md @@ -1,5 +1,34 @@ # GetPlaylistsMediaContainer +## Example Usage + +```typescript +import { GetPlaylistsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetPlaylistsMediaContainer = { + size: 4, + metadata: [ + { + ratingKey: "92", + key: "/playlists/92/items", + guid: "com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903", + type: "playlist", + title: "Static Playlist", + summary: "A Great Playlist", + smart: false, + playlistType: "video", + composite: "/playlists/92/composite/1705716440", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705716298, + duration: 7328000, + leafCount: 32, + addedAt: 1705716298, + updatedAt: 1705716440, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getplaylistsmetadata.md b/docs/models/getplaylistsmetadata.md index 8b01af90..c8a5998b 100644 --- a/docs/models/getplaylistsmetadata.md +++ b/docs/models/getplaylistsmetadata.md @@ -1,5 +1,29 @@ # GetPlaylistsMetadata +## Example Usage + +```typescript +import { GetPlaylistsMetadata } from "@lukehagar/plexjs"; + +let value: GetPlaylistsMetadata = { + ratingKey: "92", + key: "/playlists/92/items", + guid: "com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903", + type: "playlist", + title: "Static Playlist", + summary: "A Great Playlist", + smart: false, + playlistType: "video", + composite: "/playlists/92/composite/1705716440", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705716298, + duration: 7328000, + leafCount: 32, + addedAt: 1705716298, + updatedAt: 1705716440, +}; +``` ## Fields diff --git a/docs/models/getplaylistsplaylistsresponsebody.md b/docs/models/getplaylistsplaylistsresponsebody.md index f76e2c0c..295779de 100644 --- a/docs/models/getplaylistsplaylistsresponsebody.md +++ b/docs/models/getplaylistsplaylistsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetPlaylistsPlaylistsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getplaylistsrequest.md b/docs/models/getplaylistsrequest.md index 906c3ce4..7fe6775c 100644 --- a/docs/models/getplaylistsrequest.md +++ b/docs/models/getplaylistsrequest.md @@ -1,5 +1,12 @@ # GetPlaylistsRequest +## Example Usage + +```typescript +import { GetPlaylistsRequest } from "@lukehagar/plexjs"; + +let value: GetPlaylistsRequest = {}; +``` ## Fields diff --git a/docs/models/getplaylistsresponse.md b/docs/models/getplaylistsresponse.md index f1f83be5..ce84b830 100644 --- a/docs/models/getplaylistsresponse.md +++ b/docs/models/getplaylistsresponse.md @@ -1,5 +1,43 @@ # GetPlaylistsResponse +## Example Usage + +```typescript +import { GetPlaylistsResponse } from "@lukehagar/plexjs"; + +let value: GetPlaylistsResponse = { + contentType: "", + statusCode: 607831, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 4, + metadata: [ + { + ratingKey: "92", + key: "/playlists/92/items", + guid: "com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903", + type: "playlist", + title: "Static Playlist", + summary: "A Great Playlist", + smart: false, + playlistType: "video", + composite: "/playlists/92/composite/1705716440", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705716298, + duration: 7328000, + leafCount: 32, + addedAt: 1705716298, + updatedAt: 1705716440, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getplaylistsresponsebody.md b/docs/models/getplaylistsresponsebody.md index aeba429a..6de9da7b 100644 --- a/docs/models/getplaylistsresponsebody.md +++ b/docs/models/getplaylistsresponsebody.md @@ -2,6 +2,37 @@ returns all playlists +## Example Usage + +```typescript +import { GetPlaylistsResponseBody } from "@lukehagar/plexjs"; + +let value: GetPlaylistsResponseBody = { + mediaContainer: { + size: 4, + metadata: [ + { + ratingKey: "92", + key: "/playlists/92/items", + guid: "com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903", + type: "playlist", + title: "Static Playlist", + summary: "A Great Playlist", + smart: false, + playlistType: "video", + composite: "/playlists/92/composite/1705716440", + icon: "playlist://image.smart", + viewCount: 1, + lastViewedAt: 1705716298, + duration: 7328000, + leafCount: 32, + addedAt: 1705716298, + updatedAt: 1705716440, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getrecentlyaddederrors.md b/docs/models/getrecentlyaddederrors.md index 72e8d4ef..a13ce508 100644 --- a/docs/models/getrecentlyaddederrors.md +++ b/docs/models/getrecentlyaddederrors.md @@ -1,5 +1,16 @@ # GetRecentlyAddedErrors +## Example Usage + +```typescript +import { GetRecentlyAddedErrors } from "@lukehagar/plexjs"; + +let value: GetRecentlyAddedErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getrecentlyaddedlibraryresponsebody.md b/docs/models/getrecentlyaddedlibraryresponsebody.md index a84305b3..0829d7e6 100644 --- a/docs/models/getrecentlyaddedlibraryresponsebody.md +++ b/docs/models/getrecentlyaddedlibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetRecentlyAddedLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getrecentlyaddedmedia.md b/docs/models/getrecentlyaddedmedia.md index c7599cc0..40eac11d 100644 --- a/docs/models/getrecentlyaddedmedia.md +++ b/docs/models/getrecentlyaddedmedia.md @@ -1,5 +1,39 @@ # GetRecentlyAddedMedia +## Example Usage + +```typescript +import { GetRecentlyAddedMedia } from "@lukehagar/plexjs"; + +let value: GetRecentlyAddedMedia = { + id: 120345, + duration: 7474422, + bitrate: 3623, + width: 1920, + height: 804, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "ac3", + videoCodec: "h264", + videoResolution: 1080, + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + videoProfile: "high", + part: [ + { + id: 120353, + key: "/library/parts/120353/1681803203/file.mp4", + duration: 7474422, + file: "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4", + size: 3395307162, + container: "mp4", + hasThumbnail: 1, + videoProfile: "high", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getrecentlyaddedmediacontainer.md b/docs/models/getrecentlyaddedmediacontainer.md index 20428277..e77dbc15 100644 --- a/docs/models/getrecentlyaddedmediacontainer.md +++ b/docs/models/getrecentlyaddedmediacontainer.md @@ -1,5 +1,102 @@ # GetRecentlyAddedMediaContainer +## Example Usage + +```typescript +import { GetRecentlyAddedMediaContainer } from "@lukehagar/plexjs"; + +let value: GetRecentlyAddedMediaContainer = { + size: 50, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + ratingKey: 59398, + key: "/library/metadata/59398", + guid: "plex://movie/5e161a83bea6ac004126e148", + studio: "Marvel Studios", + type: "movie", + title: "Ant-Man and the Wasp: Quantumania", + contentRating: "PG-13", + summary: + "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.", + rating: 4.7, + audienceRating: 8.3, + year: 2023, + tagline: "Witness the beginning of a new dynasty.", + thumb: "/library/metadata/59398/thumb/1681888010", + art: "/library/metadata/59398/art/1681888010", + duration: 7474422, + originallyAvailableAt: new Date("2023-02-15T00:00:00Z"), + addedAt: 1681803215, + updatedAt: 1681888010, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/59399", + ratingImage: "rottentomatoes://image.rating.rotten", + media: [ + { + id: 120345, + duration: 7474422, + bitrate: 3623, + width: 1920, + height: 804, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "ac3", + videoCodec: "h264", + videoResolution: 1080, + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + videoProfile: "high", + part: [ + { + id: 120353, + key: "/library/parts/120353/1681803203/file.mp4", + duration: 7474422, + file: "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4", + size: 3395307162, + container: "mp4", + hasThumbnail: 1, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Comedy", + }, + ], + director: [ + { + tag: "Peyton Reed", + }, + ], + writer: [ + { + tag: "Jeff Loveness", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Paul Rudd", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getrecentlyaddedmetadata.md b/docs/models/getrecentlyaddedmetadata.md index 0d433eb5..eab60610 100644 --- a/docs/models/getrecentlyaddedmetadata.md +++ b/docs/models/getrecentlyaddedmetadata.md @@ -1,5 +1,94 @@ # GetRecentlyAddedMetadata +## Example Usage + +```typescript +import { GetRecentlyAddedMetadata } from "@lukehagar/plexjs"; + +let value: GetRecentlyAddedMetadata = { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + ratingKey: 59398, + key: "/library/metadata/59398", + guid: "plex://movie/5e161a83bea6ac004126e148", + studio: "Marvel Studios", + type: "movie", + title: "Ant-Man and the Wasp: Quantumania", + contentRating: "PG-13", + summary: + "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.", + rating: 4.7, + audienceRating: 8.3, + year: 2023, + tagline: "Witness the beginning of a new dynasty.", + thumb: "/library/metadata/59398/thumb/1681888010", + art: "/library/metadata/59398/art/1681888010", + duration: 7474422, + originallyAvailableAt: new Date("2023-02-15T00:00:00Z"), + addedAt: 1681803215, + updatedAt: 1681888010, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/59399", + ratingImage: "rottentomatoes://image.rating.rotten", + media: [ + { + id: 120345, + duration: 7474422, + bitrate: 3623, + width: 1920, + height: 804, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "ac3", + videoCodec: "h264", + videoResolution: 1080, + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + videoProfile: "high", + part: [ + { + id: 120353, + key: "/library/parts/120353/1681803203/file.mp4", + duration: 7474422, + file: "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4", + size: 3395307162, + container: "mp4", + hasThumbnail: 1, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Comedy", + }, + ], + director: [ + { + tag: "Peyton Reed", + }, + ], + writer: [ + { + tag: "Jeff Loveness", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Paul Rudd", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getrecentlyaddedresponse.md b/docs/models/getrecentlyaddedresponse.md index 44a1db62..3ab22db0 100644 --- a/docs/models/getrecentlyaddedresponse.md +++ b/docs/models/getrecentlyaddedresponse.md @@ -1,5 +1,111 @@ # GetRecentlyAddedResponse +## Example Usage + +```typescript +import { GetRecentlyAddedResponse } from "@lukehagar/plexjs"; + +let value: GetRecentlyAddedResponse = { + contentType: "", + statusCode: 473600, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 50, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + ratingKey: 59398, + key: "/library/metadata/59398", + guid: "plex://movie/5e161a83bea6ac004126e148", + studio: "Marvel Studios", + type: "movie", + title: "Ant-Man and the Wasp: Quantumania", + contentRating: "PG-13", + summary: + "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.", + rating: 4.7, + audienceRating: 8.3, + year: 2023, + tagline: "Witness the beginning of a new dynasty.", + thumb: "/library/metadata/59398/thumb/1681888010", + art: "/library/metadata/59398/art/1681888010", + duration: 7474422, + originallyAvailableAt: new Date("2023-02-15T00:00:00Z"), + addedAt: 1681803215, + updatedAt: 1681888010, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/59399", + ratingImage: "rottentomatoes://image.rating.rotten", + media: [ + { + id: 120345, + duration: 7474422, + bitrate: 3623, + width: 1920, + height: 804, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "ac3", + videoCodec: "h264", + videoResolution: 1080, + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + videoProfile: "high", + part: [ + { + id: 120353, + key: "/library/parts/120353/1681803203/file.mp4", + duration: 7474422, + file: "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4", + size: 3395307162, + container: "mp4", + hasThumbnail: 1, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Comedy", + }, + ], + director: [ + { + tag: "Peyton Reed", + }, + ], + writer: [ + { + tag: "Jeff Loveness", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Paul Rudd", + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getrecentlyaddedresponsebody.md b/docs/models/getrecentlyaddedresponsebody.md index 7f9c157c..6104350b 100644 --- a/docs/models/getrecentlyaddedresponsebody.md +++ b/docs/models/getrecentlyaddedresponsebody.md @@ -2,6 +2,105 @@ The recently added content +## Example Usage + +```typescript +import { GetRecentlyAddedResponseBody } from "@lukehagar/plexjs"; + +let value: GetRecentlyAddedResponseBody = { + mediaContainer: { + size: 50, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + ratingKey: 59398, + key: "/library/metadata/59398", + guid: "plex://movie/5e161a83bea6ac004126e148", + studio: "Marvel Studios", + type: "movie", + title: "Ant-Man and the Wasp: Quantumania", + contentRating: "PG-13", + summary: + "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.", + rating: 4.7, + audienceRating: 8.3, + year: 2023, + tagline: "Witness the beginning of a new dynasty.", + thumb: "/library/metadata/59398/thumb/1681888010", + art: "/library/metadata/59398/art/1681888010", + duration: 7474422, + originallyAvailableAt: new Date("2023-02-15T00:00:00Z"), + addedAt: 1681803215, + updatedAt: 1681888010, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/59399", + ratingImage: "rottentomatoes://image.rating.rotten", + media: [ + { + id: 120345, + duration: 7474422, + bitrate: 3623, + width: 1920, + height: 804, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "ac3", + videoCodec: "h264", + videoResolution: 1080, + container: "mp4", + videoFrameRate: "24p", + optimizedForStreaming: 0, + videoProfile: "high", + part: [ + { + id: 120353, + key: "/library/parts/120353/1681803203/file.mp4", + duration: 7474422, + file: "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4", + size: 3395307162, + container: "mp4", + hasThumbnail: 1, + videoProfile: "high", + }, + ], + }, + ], + genre: [ + { + tag: "Comedy", + }, + ], + director: [ + { + tag: "Peyton Reed", + }, + ], + writer: [ + { + tag: "Jeff Loveness", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Paul Rudd", + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getresizedphotoerrors.md b/docs/models/getresizedphotoerrors.md index d4b7bbaf..25fb01e5 100644 --- a/docs/models/getresizedphotoerrors.md +++ b/docs/models/getresizedphotoerrors.md @@ -1,5 +1,16 @@ # GetResizedPhotoErrors +## Example Usage + +```typescript +import { GetResizedPhotoErrors } from "@lukehagar/plexjs"; + +let value: GetResizedPhotoErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getresizedphotorequest.md b/docs/models/getresizedphotorequest.md index ab20a4a8..87331461 100644 --- a/docs/models/getresizedphotorequest.md +++ b/docs/models/getresizedphotorequest.md @@ -1,5 +1,20 @@ # GetResizedPhotoRequest +## Example Usage + +```typescript +import { GetResizedPhotoRequest, MinSize, Upscale } from "@lukehagar/plexjs"; + +let value: GetResizedPhotoRequest = { + width: 110, + height: 165, + opacity: 100, + blur: 20, + minSize: MinSize.One, + upscale: Upscale.One, + url: "/library/metadata/49564/thumb/1654258204", +}; +``` ## Fields diff --git a/docs/models/getresizedphotoresponse.md b/docs/models/getresizedphotoresponse.md index 63d8b4cc..7dd527eb 100644 --- a/docs/models/getresizedphotoresponse.md +++ b/docs/models/getresizedphotoresponse.md @@ -1,5 +1,18 @@ # GetResizedPhotoResponse +## Example Usage + +```typescript +import { GetResizedPhotoResponse } from "@lukehagar/plexjs"; + +let value: GetResizedPhotoResponse = { + contentType: "", + statusCode: 384382, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/getresizedphotoresponsebody.md b/docs/models/getresizedphotoresponsebody.md index 3a9b8bdd..9cf404fc 100644 --- a/docs/models/getresizedphotoresponsebody.md +++ b/docs/models/getresizedphotoresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetResizedPhotoResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getresourceserrors.md b/docs/models/getresourceserrors.md new file mode 100644 index 00000000..700f7315 --- /dev/null +++ b/docs/models/getresourceserrors.md @@ -0,0 +1,21 @@ +# GetResourcesErrors + +## Example Usage + +```typescript +import { GetResourcesErrors } from "@lukehagar/plexjs"; + +let value: GetResourcesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *number* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/gettokenglobals.md b/docs/models/getresourcesglobals.md similarity index 94% rename from docs/models/gettokenglobals.md rename to docs/models/getresourcesglobals.md index bd7fe3f2..dd306e74 100644 --- a/docs/models/gettokenglobals.md +++ b/docs/models/getresourcesglobals.md @@ -1,5 +1,12 @@ -# GetTokenGlobals +# GetResourcesGlobals +## Example Usage + +```typescript +import { GetResourcesGlobals } from "@lukehagar/plexjs"; + +let value: GetResourcesGlobals = {}; +``` ## Fields diff --git a/docs/models/getresourcesrequest.md b/docs/models/getresourcesrequest.md new file mode 100644 index 00000000..99ea84bf --- /dev/null +++ b/docs/models/getresourcesrequest.md @@ -0,0 +1,18 @@ +# GetResourcesRequest + +## Example Usage + +```typescript +import { GetResourcesRequest } from "@lukehagar/plexjs"; + +let value: GetResourcesRequest = {}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | +| `includeHttps` | [models.IncludeHttps](../models/includehttps.md) | :heavy_minus_sign: | Include Https entries in the results | | +| `includeRelay` | [models.IncludeRelay](../models/includerelay.md) | :heavy_minus_sign: | Include Relay addresses in the results | | +| `includeIPv6` | [models.IncludeIPv6](../models/includeipv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | | \ No newline at end of file diff --git a/docs/models/gettokenresponse.md b/docs/models/getresourcesresponse.md similarity index 70% rename from docs/models/gettokenresponse.md rename to docs/models/getresourcesresponse.md index 4495d855..cf9299bc 100644 --- a/docs/models/gettokenresponse.md +++ b/docs/models/getresourcesresponse.md @@ -1,5 +1,18 @@ -# GetTokenResponse +# GetResourcesResponse +## Example Usage + +```typescript +import { GetResourcesResponse } from "@lukehagar/plexjs"; + +let value: GetResourcesResponse = { + contentType: "", + statusCode: 473608, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields @@ -8,4 +21,4 @@ | `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `object` | [models.GetTokenResponseBody](../models/gettokenresponsebody.md) | :heavy_minus_sign: | Access Token | \ No newline at end of file +| `plexDevices` | [models.PlexDevice](../models/plexdevice.md)[] | :heavy_minus_sign: | List of Plex Devices. This includes Plex hosted servers and clients | \ No newline at end of file diff --git a/docs/models/getresourcesresponsebody.md b/docs/models/getresourcesresponsebody.md new file mode 100644 index 00000000..9461264e --- /dev/null +++ b/docs/models/getresourcesresponsebody.md @@ -0,0 +1,18 @@ +# GetResourcesResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + +## Example Usage + +```typescript +import { GetResourcesResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `errors` | [models.GetResourcesErrors](../models/getresourceserrors.md)[] | :heavy_minus_sign: | N/A | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/getresourcesstatisticserrors.md b/docs/models/getresourcesstatisticserrors.md index 1ef29ef1..5b16cb8a 100644 --- a/docs/models/getresourcesstatisticserrors.md +++ b/docs/models/getresourcesstatisticserrors.md @@ -1,5 +1,16 @@ # GetResourcesStatisticsErrors +## Example Usage + +```typescript +import { GetResourcesStatisticsErrors } from "@lukehagar/plexjs"; + +let value: GetResourcesStatisticsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getresourcesstatisticsmediacontainer.md b/docs/models/getresourcesstatisticsmediacontainer.md index 9e4da66e..b0b8fe2a 100644 --- a/docs/models/getresourcesstatisticsmediacontainer.md +++ b/docs/models/getresourcesstatisticsmediacontainer.md @@ -1,5 +1,24 @@ # GetResourcesStatisticsMediaContainer +## Example Usage + +```typescript +import { GetResourcesStatisticsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetResourcesStatisticsMediaContainer = { + size: 5497, + statisticsResources: [ + { + timespan: 6, + at: 1718384427, + hostCpuUtilization: 1.276, + processCpuUtilization: 0.025, + hostMemoryUtilization: 17.026, + processMemoryUtilization: 0.493, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getresourcesstatisticsrequest.md b/docs/models/getresourcesstatisticsrequest.md index 6c704ac1..1268f8ac 100644 --- a/docs/models/getresourcesstatisticsrequest.md +++ b/docs/models/getresourcesstatisticsrequest.md @@ -1,5 +1,14 @@ # GetResourcesStatisticsRequest +## Example Usage + +```typescript +import { GetResourcesStatisticsRequest } from "@lukehagar/plexjs"; + +let value: GetResourcesStatisticsRequest = { + timespan: 4, +}; +``` ## Fields diff --git a/docs/models/getresourcesstatisticsresponse.md b/docs/models/getresourcesstatisticsresponse.md index 7c4837de..d241f8a1 100644 --- a/docs/models/getresourcesstatisticsresponse.md +++ b/docs/models/getresourcesstatisticsresponse.md @@ -1,5 +1,33 @@ # GetResourcesStatisticsResponse +## Example Usage + +```typescript +import { GetResourcesStatisticsResponse } from "@lukehagar/plexjs"; + +let value: GetResourcesStatisticsResponse = { + contentType: "", + statusCode: 244425, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 5497, + statisticsResources: [ + { + timespan: 6, + at: 1718384427, + hostCpuUtilization: 1.276, + processCpuUtilization: 0.025, + hostMemoryUtilization: 17.026, + processMemoryUtilization: 0.493, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getresourcesstatisticsresponsebody.md b/docs/models/getresourcesstatisticsresponsebody.md index e227e6a6..adad7976 100644 --- a/docs/models/getresourcesstatisticsresponsebody.md +++ b/docs/models/getresourcesstatisticsresponsebody.md @@ -2,6 +2,27 @@ Resource Statistics +## Example Usage + +```typescript +import { GetResourcesStatisticsResponseBody } from "@lukehagar/plexjs"; + +let value: GetResourcesStatisticsResponseBody = { + mediaContainer: { + size: 5497, + statisticsResources: [ + { + timespan: 6, + at: 1718384427, + hostCpuUtilization: 1.276, + processCpuUtilization: 0.025, + hostMemoryUtilization: 17.026, + processMemoryUtilization: 0.493, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getresourcesstatisticsstatisticsresponsebody.md b/docs/models/getresourcesstatisticsstatisticsresponsebody.md index 4f2a5a5b..1e1117a7 100644 --- a/docs/models/getresourcesstatisticsstatisticsresponsebody.md +++ b/docs/models/getresourcesstatisticsstatisticsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetResourcesStatisticsStatisticsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getsearchresultscountry.md b/docs/models/getsearchresultscountry.md index e63aab0a..235da461 100644 --- a/docs/models/getsearchresultscountry.md +++ b/docs/models/getsearchresultscountry.md @@ -1,5 +1,14 @@ # GetSearchResultsCountry +## Example Usage + +```typescript +import { GetSearchResultsCountry } from "@lukehagar/plexjs"; + +let value: GetSearchResultsCountry = { + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/getsearchresultsdirector.md b/docs/models/getsearchresultsdirector.md index 3bf85017..c3d0a437 100644 --- a/docs/models/getsearchresultsdirector.md +++ b/docs/models/getsearchresultsdirector.md @@ -1,5 +1,14 @@ # GetSearchResultsDirector +## Example Usage + +```typescript +import { GetSearchResultsDirector } from "@lukehagar/plexjs"; + +let value: GetSearchResultsDirector = { + tag: "Brian De Palma", +}; +``` ## Fields diff --git a/docs/models/getsearchresultserrors.md b/docs/models/getsearchresultserrors.md index cc4bc0ed..9316e450 100644 --- a/docs/models/getsearchresultserrors.md +++ b/docs/models/getsearchresultserrors.md @@ -1,5 +1,16 @@ # GetSearchResultsErrors +## Example Usage + +```typescript +import { GetSearchResultsErrors } from "@lukehagar/plexjs"; + +let value: GetSearchResultsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getsearchresultsgenre.md b/docs/models/getsearchresultsgenre.md index 69646c7f..7e3739d5 100644 --- a/docs/models/getsearchresultsgenre.md +++ b/docs/models/getsearchresultsgenre.md @@ -1,5 +1,14 @@ # GetSearchResultsGenre +## Example Usage + +```typescript +import { GetSearchResultsGenre } from "@lukehagar/plexjs"; + +let value: GetSearchResultsGenre = { + tag: "Action", +}; +``` ## Fields diff --git a/docs/models/getsearchresultsmedia.md b/docs/models/getsearchresultsmedia.md index f684e744..5e57976b 100644 --- a/docs/models/getsearchresultsmedia.md +++ b/docs/models/getsearchresultsmedia.md @@ -1,5 +1,39 @@ # GetSearchResultsMedia +## Example Usage + +```typescript +import { GetSearchResultsMedia } from "@lukehagar/plexjs"; + +let value: GetSearchResultsMedia = { + id: 26610, + duration: 6612628, + bitrate: 4751, + width: 1916, + height: 796, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: 1080, + container: "mkv", + videoFrameRate: "24p", + audioProfile: "lc", + videoProfile: "main 10", + part: [ + { + id: 26610, + key: "/library/parts/26610/1589234571/file.mkv", + duration: 6612628, + file: "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv", + size: 3926903851, + audioProfile: "lc", + container: "mkv", + videoProfile: "main 10", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsearchresultsmediacontainer.md b/docs/models/getsearchresultsmediacontainer.md index d2d82a3c..3d63d742 100644 --- a/docs/models/getsearchresultsmediacontainer.md +++ b/docs/models/getsearchresultsmediacontainer.md @@ -1,5 +1,110 @@ # GetSearchResultsMediaContainer +## Example Usage + +```typescript +import { GetSearchResultsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetSearchResultsMediaContainer = { + size: 26, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + sourceTitle: "Hera", + ratingKey: 10398, + key: "/library/metadata/10398", + guid: "plex://movie/5d7768284de0ee001fcc8f52", + studio: "Paramount", + type: "movie", + title: "Mission: Impossible", + contentRating: "PG-13", + summary: + "When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.", + rating: 6.6, + audienceRating: 7.1, + year: 1996, + tagline: "Expect the impossible.", + thumb: "/library/metadata/10398/thumb/1679505055", + art: "/library/metadata/10398/art/1679505055", + duration: 6612628, + originallyAvailableAt: new Date("1996-05-22T00:00:00Z"), + addedAt: 1589234571, + updatedAt: 1679505055, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/10501", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 26610, + duration: 6612628, + bitrate: 4751, + width: 1916, + height: 796, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: 1080, + container: "mkv", + videoFrameRate: "24p", + audioProfile: "lc", + videoProfile: "main 10", + part: [ + { + id: 26610, + key: "/library/parts/26610/1589234571/file.mkv", + duration: 6612628, + file: "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv", + size: 3926903851, + audioProfile: "lc", + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + director: [ + { + tag: "Brian De Palma", + }, + ], + writer: [ + { + tag: "David Koepp", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Tom Cruise", + }, + ], + }, + ], + provider: [ + { + key: "/system/search", + title: "Local Network", + type: "mixed", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsearchresultsmetadata.md b/docs/models/getsearchresultsmetadata.md index f5f76912..61c11e7b 100644 --- a/docs/models/getsearchresultsmetadata.md +++ b/docs/models/getsearchresultsmetadata.md @@ -1,5 +1,95 @@ # GetSearchResultsMetadata +## Example Usage + +```typescript +import { GetSearchResultsMetadata } from "@lukehagar/plexjs"; + +let value: GetSearchResultsMetadata = { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + sourceTitle: "Hera", + ratingKey: 10398, + key: "/library/metadata/10398", + guid: "plex://movie/5d7768284de0ee001fcc8f52", + studio: "Paramount", + type: "movie", + title: "Mission: Impossible", + contentRating: "PG-13", + summary: + "When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.", + rating: 6.6, + audienceRating: 7.1, + year: 1996, + tagline: "Expect the impossible.", + thumb: "/library/metadata/10398/thumb/1679505055", + art: "/library/metadata/10398/art/1679505055", + duration: 6612628, + originallyAvailableAt: new Date("1996-05-22T00:00:00Z"), + addedAt: 1589234571, + updatedAt: 1679505055, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/10501", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 26610, + duration: 6612628, + bitrate: 4751, + width: 1916, + height: 796, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: 1080, + container: "mkv", + videoFrameRate: "24p", + audioProfile: "lc", + videoProfile: "main 10", + part: [ + { + id: 26610, + key: "/library/parts/26610/1589234571/file.mkv", + duration: 6612628, + file: "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv", + size: 3926903851, + audioProfile: "lc", + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + director: [ + { + tag: "Brian De Palma", + }, + ], + writer: [ + { + tag: "David Koepp", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Tom Cruise", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsearchresultspart.md b/docs/models/getsearchresultspart.md index dd780c58..5739da90 100644 --- a/docs/models/getsearchresultspart.md +++ b/docs/models/getsearchresultspart.md @@ -1,5 +1,21 @@ # GetSearchResultsPart +## Example Usage + +```typescript +import { GetSearchResultsPart } from "@lukehagar/plexjs"; + +let value: GetSearchResultsPart = { + id: 26610, + key: "/library/parts/26610/1589234571/file.mkv", + duration: 6612628, + file: "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv", + size: 3926903851, + audioProfile: "lc", + container: "mkv", + videoProfile: "main 10", +}; +``` ## Fields diff --git a/docs/models/getsearchresultsrequest.md b/docs/models/getsearchresultsrequest.md index 72579d97..5b9c3e2c 100644 --- a/docs/models/getsearchresultsrequest.md +++ b/docs/models/getsearchresultsrequest.md @@ -1,5 +1,14 @@ # GetSearchResultsRequest +## Example Usage + +```typescript +import { GetSearchResultsRequest } from "@lukehagar/plexjs"; + +let value: GetSearchResultsRequest = { + query: "110", +}; +``` ## Fields diff --git a/docs/models/getsearchresultsresponse.md b/docs/models/getsearchresultsresponse.md index 2133b1fe..c244e8d8 100644 --- a/docs/models/getsearchresultsresponse.md +++ b/docs/models/getsearchresultsresponse.md @@ -1,5 +1,119 @@ # GetSearchResultsResponse +## Example Usage + +```typescript +import { GetSearchResultsResponse } from "@lukehagar/plexjs"; + +let value: GetSearchResultsResponse = { + contentType: "", + statusCode: 105907, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 26, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + sourceTitle: "Hera", + ratingKey: 10398, + key: "/library/metadata/10398", + guid: "plex://movie/5d7768284de0ee001fcc8f52", + studio: "Paramount", + type: "movie", + title: "Mission: Impossible", + contentRating: "PG-13", + summary: + "When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.", + rating: 6.6, + audienceRating: 7.1, + year: 1996, + tagline: "Expect the impossible.", + thumb: "/library/metadata/10398/thumb/1679505055", + art: "/library/metadata/10398/art/1679505055", + duration: 6612628, + originallyAvailableAt: new Date("1996-05-22T00:00:00Z"), + addedAt: 1589234571, + updatedAt: 1679505055, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/10501", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 26610, + duration: 6612628, + bitrate: 4751, + width: 1916, + height: 796, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: 1080, + container: "mkv", + videoFrameRate: "24p", + audioProfile: "lc", + videoProfile: "main 10", + part: [ + { + id: 26610, + key: "/library/parts/26610/1589234571/file.mkv", + duration: 6612628, + file: "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv", + size: 3926903851, + audioProfile: "lc", + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + director: [ + { + tag: "Brian De Palma", + }, + ], + writer: [ + { + tag: "David Koepp", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Tom Cruise", + }, + ], + }, + ], + provider: [ + { + key: "/system/search", + title: "Local Network", + type: "mixed", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getsearchresultsresponsebody.md b/docs/models/getsearchresultsresponsebody.md index 49b5f143..1673e709 100644 --- a/docs/models/getsearchresultsresponsebody.md +++ b/docs/models/getsearchresultsresponsebody.md @@ -2,6 +2,113 @@ Search Results +## Example Usage + +```typescript +import { GetSearchResultsResponseBody } from "@lukehagar/plexjs"; + +let value: GetSearchResultsResponseBody = { + mediaContainer: { + size: 26, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1680021154, + metadata: [ + { + librarySectionID: 1, + librarySectionTitle: "Movies", + librarySectionUUID: "322a231a-b7f7-49f5-920f-14c61199cd30", + sourceTitle: "Hera", + ratingKey: 10398, + key: "/library/metadata/10398", + guid: "plex://movie/5d7768284de0ee001fcc8f52", + studio: "Paramount", + type: "movie", + title: "Mission: Impossible", + contentRating: "PG-13", + summary: + "When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.", + rating: 6.6, + audienceRating: 7.1, + year: 1996, + tagline: "Expect the impossible.", + thumb: "/library/metadata/10398/thumb/1679505055", + art: "/library/metadata/10398/art/1679505055", + duration: 6612628, + originallyAvailableAt: new Date("1996-05-22T00:00:00Z"), + addedAt: 1589234571, + updatedAt: 1679505055, + audienceRatingImage: "rottentomatoes://image.rating.upright", + chapterSource: "media", + primaryExtraKey: "/library/metadata/10501", + ratingImage: "rottentomatoes://image.rating.ripe", + media: [ + { + id: 26610, + duration: 6612628, + bitrate: 4751, + width: 1916, + height: 796, + aspectRatio: 2.35, + audioChannels: 6, + audioCodec: "aac", + videoCodec: "hevc", + videoResolution: 1080, + container: "mkv", + videoFrameRate: "24p", + audioProfile: "lc", + videoProfile: "main 10", + part: [ + { + id: 26610, + key: "/library/parts/26610/1589234571/file.mkv", + duration: 6612628, + file: "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv", + size: 3926903851, + audioProfile: "lc", + container: "mkv", + videoProfile: "main 10", + }, + ], + }, + ], + genre: [ + { + tag: "Action", + }, + ], + director: [ + { + tag: "Brian De Palma", + }, + ], + writer: [ + { + tag: "David Koepp", + }, + ], + country: [ + { + tag: "United States of America", + }, + ], + role: [ + { + tag: "Tom Cruise", + }, + ], + }, + ], + provider: [ + { + key: "/system/search", + title: "Local Network", + type: "mixed", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getsearchresultsrole.md b/docs/models/getsearchresultsrole.md index 719cffc6..c64d9bd0 100644 --- a/docs/models/getsearchresultsrole.md +++ b/docs/models/getsearchresultsrole.md @@ -1,5 +1,14 @@ # GetSearchResultsRole +## Example Usage + +```typescript +import { GetSearchResultsRole } from "@lukehagar/plexjs"; + +let value: GetSearchResultsRole = { + tag: "Tom Cruise", +}; +``` ## Fields diff --git a/docs/models/getsearchresultssearchresponsebody.md b/docs/models/getsearchresultssearchresponsebody.md index 08b099d1..70cfc708 100644 --- a/docs/models/getsearchresultssearchresponsebody.md +++ b/docs/models/getsearchresultssearchresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetSearchResultsSearchResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getsearchresultswriter.md b/docs/models/getsearchresultswriter.md index 0f842bfe..cf1fe421 100644 --- a/docs/models/getsearchresultswriter.md +++ b/docs/models/getsearchresultswriter.md @@ -1,5 +1,14 @@ # GetSearchResultsWriter +## Example Usage + +```typescript +import { GetSearchResultsWriter } from "@lukehagar/plexjs"; + +let value: GetSearchResultsWriter = { + tag: "David Koepp", +}; +``` ## Fields diff --git a/docs/models/getserveractivitiesactivitiesresponsebody.md b/docs/models/getserveractivitiesactivitiesresponsebody.md index 24c757bb..729c0ba0 100644 --- a/docs/models/getserveractivitiesactivitiesresponsebody.md +++ b/docs/models/getserveractivitiesactivitiesresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetServerActivitiesActivitiesResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getserveractivitieserrors.md b/docs/models/getserveractivitieserrors.md index c081aa81..27d7bee1 100644 --- a/docs/models/getserveractivitieserrors.md +++ b/docs/models/getserveractivitieserrors.md @@ -1,5 +1,16 @@ # GetServerActivitiesErrors +## Example Usage + +```typescript +import { GetServerActivitiesErrors } from "@lukehagar/plexjs"; + +let value: GetServerActivitiesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getserveractivitiesmediacontainer.md b/docs/models/getserveractivitiesmediacontainer.md index d5594128..3b682f78 100644 --- a/docs/models/getserveractivitiesmediacontainer.md +++ b/docs/models/getserveractivitiesmediacontainer.md @@ -1,5 +1,12 @@ # GetServerActivitiesMediaContainer +## Example Usage + +```typescript +import { GetServerActivitiesMediaContainer } from "@lukehagar/plexjs"; + +let value: GetServerActivitiesMediaContainer = {}; +``` ## Fields diff --git a/docs/models/getserveractivitiesresponse.md b/docs/models/getserveractivitiesresponse.md index 7c28a604..49e12798 100644 --- a/docs/models/getserveractivitiesresponse.md +++ b/docs/models/getserveractivitiesresponse.md @@ -1,5 +1,18 @@ # GetServerActivitiesResponse +## Example Usage + +```typescript +import { GetServerActivitiesResponse } from "@lukehagar/plexjs"; + +let value: GetServerActivitiesResponse = { + contentType: "", + statusCode: 383441, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/getserveractivitiesresponsebody.md b/docs/models/getserveractivitiesresponsebody.md index fe88c72d..8aa93dd0 100644 --- a/docs/models/getserveractivitiesresponsebody.md +++ b/docs/models/getserveractivitiesresponsebody.md @@ -2,6 +2,13 @@ The Server Activities +## Example Usage + +```typescript +import { GetServerActivitiesResponseBody } from "@lukehagar/plexjs"; + +let value: GetServerActivitiesResponseBody = {}; +``` ## Fields diff --git a/docs/models/getservercapabilitiesresponse.md b/docs/models/getservercapabilitiesresponse.md index 7c9b2f8f..ab72d0e4 100644 --- a/docs/models/getservercapabilitiesresponse.md +++ b/docs/models/getservercapabilitiesresponse.md @@ -1,5 +1,18 @@ # GetServerCapabilitiesResponse +## Example Usage + +```typescript +import { GetServerCapabilitiesResponse } from "@lukehagar/plexjs"; + +let value: GetServerCapabilitiesResponse = { + contentType: "", + statusCode: 548814, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/getservercapabilitiesresponsebody.md b/docs/models/getservercapabilitiesresponsebody.md index adc5dd3b..638ab195 100644 --- a/docs/models/getservercapabilitiesresponsebody.md +++ b/docs/models/getservercapabilitiesresponsebody.md @@ -2,6 +2,13 @@ The Server Capabilities +## Example Usage + +```typescript +import { GetServerCapabilitiesResponseBody } from "@lukehagar/plexjs"; + +let value: GetServerCapabilitiesResponseBody = {}; +``` ## Fields diff --git a/docs/models/getservercapabilitiesserverresponsebody.md b/docs/models/getservercapabilitiesserverresponsebody.md index 70bc4408..81daae82 100644 --- a/docs/models/getservercapabilitiesserverresponsebody.md +++ b/docs/models/getservercapabilitiesserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetServerCapabilitiesServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getserveridentityerrors.md b/docs/models/getserveridentityerrors.md index e5f6bf74..4bc147fb 100644 --- a/docs/models/getserveridentityerrors.md +++ b/docs/models/getserveridentityerrors.md @@ -1,5 +1,16 @@ # GetServerIdentityErrors +## Example Usage + +```typescript +import { GetServerIdentityErrors } from "@lukehagar/plexjs"; + +let value: GetServerIdentityErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getserveridentitymediacontainer.md b/docs/models/getserveridentitymediacontainer.md index cfabc04f..16157de6 100644 --- a/docs/models/getserveridentitymediacontainer.md +++ b/docs/models/getserveridentitymediacontainer.md @@ -1,5 +1,16 @@ # GetServerIdentityMediaContainer +## Example Usage + +```typescript +import { GetServerIdentityMediaContainer } from "@lukehagar/plexjs"; + +let value: GetServerIdentityMediaContainer = { + size: 0, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", +}; +``` ## Fields diff --git a/docs/models/getserveridentityresponse.md b/docs/models/getserveridentityresponse.md index 80cc7c76..a85ba036 100644 --- a/docs/models/getserveridentityresponse.md +++ b/docs/models/getserveridentityresponse.md @@ -1,5 +1,25 @@ # GetServerIdentityResponse +## Example Usage + +```typescript +import { GetServerIdentityResponse } from "@lukehagar/plexjs"; + +let value: GetServerIdentityResponse = { + contentType: "", + statusCode: 602763, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 0, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", + }, + }, +}; +``` ## Fields diff --git a/docs/models/getserveridentityresponsebody.md b/docs/models/getserveridentityresponsebody.md index c5bca584..1d443ed5 100644 --- a/docs/models/getserveridentityresponsebody.md +++ b/docs/models/getserveridentityresponsebody.md @@ -2,6 +2,19 @@ The Server Identity information +## Example Usage + +```typescript +import { GetServerIdentityResponseBody } from "@lukehagar/plexjs"; + +let value: GetServerIdentityResponseBody = { + mediaContainer: { + size: 0, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", + }, +}; +``` ## Fields diff --git a/docs/models/getserveridentityserverresponsebody.md b/docs/models/getserveridentityserverresponsebody.md index 81614753..d4fddf7b 100644 --- a/docs/models/getserveridentityserverresponsebody.md +++ b/docs/models/getserveridentityserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetServerIdentityServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getserverlisterrors.md b/docs/models/getserverlisterrors.md index 837e7558..43f8e49b 100644 --- a/docs/models/getserverlisterrors.md +++ b/docs/models/getserverlisterrors.md @@ -1,5 +1,16 @@ # GetServerListErrors +## Example Usage + +```typescript +import { GetServerListErrors } from "@lukehagar/plexjs"; + +let value: GetServerListErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getserverlistmediacontainer.md b/docs/models/getserverlistmediacontainer.md index 3bf6c64c..97fe2be3 100644 --- a/docs/models/getserverlistmediacontainer.md +++ b/docs/models/getserverlistmediacontainer.md @@ -1,5 +1,24 @@ # GetServerListMediaContainer +## Example Usage + +```typescript +import { GetServerListMediaContainer } from "@lukehagar/plexjs"; + +let value: GetServerListMediaContainer = { + size: 1, + server: [ + { + name: "Hera", + host: "10.10.10.47", + address: "10.10.10.47", + port: 32400, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getserverlistresponse.md b/docs/models/getserverlistresponse.md index a97231d8..49e32b96 100644 --- a/docs/models/getserverlistresponse.md +++ b/docs/models/getserverlistresponse.md @@ -1,5 +1,33 @@ # GetServerListResponse +## Example Usage + +```typescript +import { GetServerListResponse } from "@lukehagar/plexjs"; + +let value: GetServerListResponse = { + contentType: "", + statusCode: 437587, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + server: [ + { + name: "Hera", + host: "10.10.10.47", + address: "10.10.10.47", + port: 32400, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getserverlistresponsebody.md b/docs/models/getserverlistresponsebody.md index c5b40beb..b37a2c0a 100644 --- a/docs/models/getserverlistresponsebody.md +++ b/docs/models/getserverlistresponsebody.md @@ -2,6 +2,27 @@ List of Servers +## Example Usage + +```typescript +import { GetServerListResponseBody } from "@lukehagar/plexjs"; + +let value: GetServerListResponseBody = { + mediaContainer: { + size: 1, + server: [ + { + name: "Hera", + host: "10.10.10.47", + address: "10.10.10.47", + port: 32400, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getserverlistserver.md b/docs/models/getserverlistserver.md index e55d49c3..95ccbf7f 100644 --- a/docs/models/getserverlistserver.md +++ b/docs/models/getserverlistserver.md @@ -1,5 +1,19 @@ # GetServerListServer +## Example Usage + +```typescript +import { GetServerListServer } from "@lukehagar/plexjs"; + +let value: GetServerListServer = { + name: "Hera", + host: "10.10.10.47", + address: "10.10.10.47", + port: 32400, + machineIdentifier: "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", + version: "1.31.3.6868-28fc46b27", +}; +``` ## Fields diff --git a/docs/models/getserverlistserverresponsebody.md b/docs/models/getserverlistserverresponsebody.md index b39e8812..9d17fb55 100644 --- a/docs/models/getserverlistserverresponsebody.md +++ b/docs/models/getserverlistserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetServerListServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getserverpreferenceserrors.md b/docs/models/getserverpreferenceserrors.md index bdd82a28..c6e602ab 100644 --- a/docs/models/getserverpreferenceserrors.md +++ b/docs/models/getserverpreferenceserrors.md @@ -1,5 +1,16 @@ # GetServerPreferencesErrors +## Example Usage + +```typescript +import { GetServerPreferencesErrors } from "@lukehagar/plexjs"; + +let value: GetServerPreferencesErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getserverpreferencesmediacontainer.md b/docs/models/getserverpreferencesmediacontainer.md index 12f275e7..72114225 100644 --- a/docs/models/getserverpreferencesmediacontainer.md +++ b/docs/models/getserverpreferencesmediacontainer.md @@ -1,5 +1,28 @@ # GetServerPreferencesMediaContainer +## Example Usage + +```typescript +import { GetServerPreferencesMediaContainer } from "@lukehagar/plexjs"; + +let value: GetServerPreferencesMediaContainer = { + size: 161, + setting: [ + { + id: "EnableDatabaseTrace", + label: "", + summary: "", + type: "bool", + default: false, + value: false, + hidden: true, + advanced: false, + group: "", + enumValues: "1:admin only|2:everyone", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getserverpreferencesresponse.md b/docs/models/getserverpreferencesresponse.md index 5a89c771..c1464d0d 100644 --- a/docs/models/getserverpreferencesresponse.md +++ b/docs/models/getserverpreferencesresponse.md @@ -1,5 +1,37 @@ # GetServerPreferencesResponse +## Example Usage + +```typescript +import { GetServerPreferencesResponse } from "@lukehagar/plexjs"; + +let value: GetServerPreferencesResponse = { + contentType: "", + statusCode: 592845, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 161, + setting: [ + { + id: "EnableDatabaseTrace", + label: "", + summary: "", + type: "bool", + default: false, + value: false, + hidden: true, + advanced: false, + group: "", + enumValues: "1:admin only|2:everyone", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getserverpreferencesresponsebody.md b/docs/models/getserverpreferencesresponsebody.md index d2e9dfa4..d46dd146 100644 --- a/docs/models/getserverpreferencesresponsebody.md +++ b/docs/models/getserverpreferencesresponsebody.md @@ -2,6 +2,31 @@ Server Preferences +## Example Usage + +```typescript +import { GetServerPreferencesResponseBody } from "@lukehagar/plexjs"; + +let value: GetServerPreferencesResponseBody = { + mediaContainer: { + size: 161, + setting: [ + { + id: "EnableDatabaseTrace", + label: "", + summary: "", + type: "bool", + default: false, + value: false, + hidden: true, + advanced: false, + group: "", + enumValues: "1:admin only|2:everyone", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getserverpreferencesserverresponsebody.md b/docs/models/getserverpreferencesserverresponsebody.md index 719a7013..b71e3bc0 100644 --- a/docs/models/getserverpreferencesserverresponsebody.md +++ b/docs/models/getserverpreferencesserverresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetServerPreferencesServerResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getsessionhistoryerrors.md b/docs/models/getsessionhistoryerrors.md index 8a49ec1e..5a9aa016 100644 --- a/docs/models/getsessionhistoryerrors.md +++ b/docs/models/getsessionhistoryerrors.md @@ -1,5 +1,16 @@ # GetSessionHistoryErrors +## Example Usage + +```typescript +import { GetSessionHistoryErrors } from "@lukehagar/plexjs"; + +let value: GetSessionHistoryErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getsessionhistorymediacontainer.md b/docs/models/getsessionhistorymediacontainer.md index b72fbbd2..3f88ec68 100644 --- a/docs/models/getsessionhistorymediacontainer.md +++ b/docs/models/getsessionhistorymediacontainer.md @@ -1,5 +1,38 @@ # GetSessionHistoryMediaContainer +## Example Usage + +```typescript +import { GetSessionHistoryMediaContainer } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetSessionHistoryMediaContainer = { + size: 10855, + metadata: [ + { + historyKey: "/status/sessions/history/1", + key: "/library/metadata/32171", + ratingKey: "32171", + librarySectionID: "2", + parentKey: "/library/metadata/32170", + grandparentKey: "/library/metadata/32132", + title: "The Noise That Blue Makes", + grandparentTitle: "Taskmaster", + type: "episode", + thumb: "/library/metadata/32171/thumb/-1", + parentThumb: "/library/metadata/32170/thumb/1654134301", + grandparentThumb: "/library/metadata/32132/thumb/1703933346", + grandparentArt: "/library/metadata/32132/art/1703933346", + index: 1, + parentIndex: 13, + originallyAvailableAt: new RFCDate("2022-04-14T00:00:00Z"), + viewedAt: 1654139223, + accountID: 1, + deviceID: 5, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsessionhistorymetadata.md b/docs/models/getsessionhistorymetadata.md index 1fc1ad28..6a2791ca 100644 --- a/docs/models/getsessionhistorymetadata.md +++ b/docs/models/getsessionhistorymetadata.md @@ -1,5 +1,33 @@ # GetSessionHistoryMetadata +## Example Usage + +```typescript +import { GetSessionHistoryMetadata } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetSessionHistoryMetadata = { + historyKey: "/status/sessions/history/1", + key: "/library/metadata/32171", + ratingKey: "32171", + librarySectionID: "2", + parentKey: "/library/metadata/32170", + grandparentKey: "/library/metadata/32132", + title: "The Noise That Blue Makes", + grandparentTitle: "Taskmaster", + type: "episode", + thumb: "/library/metadata/32171/thumb/-1", + parentThumb: "/library/metadata/32170/thumb/1654134301", + grandparentThumb: "/library/metadata/32132/thumb/1703933346", + grandparentArt: "/library/metadata/32132/art/1703933346", + index: 1, + parentIndex: 13, + originallyAvailableAt: new RFCDate("2022-04-14T00:00:00Z"), + viewedAt: 1654139223, + accountID: 1, + deviceID: 5, +}; +``` ## Fields diff --git a/docs/models/getsessionhistoryrequest.md b/docs/models/getsessionhistoryrequest.md index 03c4bf68..8fde4581 100644 --- a/docs/models/getsessionhistoryrequest.md +++ b/docs/models/getsessionhistoryrequest.md @@ -1,5 +1,16 @@ # GetSessionHistoryRequest +## Example Usage + +```typescript +import { GetSessionHistoryRequest } from "@lukehagar/plexjs"; + +let value: GetSessionHistoryRequest = { + accountId: 1, + filter: {}, + librarySectionID: 12, +}; +``` ## Fields diff --git a/docs/models/getsessionhistoryresponse.md b/docs/models/getsessionhistoryresponse.md index 441ee8c7..47047a85 100644 --- a/docs/models/getsessionhistoryresponse.md +++ b/docs/models/getsessionhistoryresponse.md @@ -1,5 +1,47 @@ # GetSessionHistoryResponse +## Example Usage + +```typescript +import { GetSessionHistoryResponse } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetSessionHistoryResponse = { + contentType: "", + statusCode: 338007, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 10855, + metadata: [ + { + historyKey: "/status/sessions/history/1", + key: "/library/metadata/32171", + ratingKey: "32171", + librarySectionID: "2", + parentKey: "/library/metadata/32170", + grandparentKey: "/library/metadata/32132", + title: "The Noise That Blue Makes", + grandparentTitle: "Taskmaster", + type: "episode", + thumb: "/library/metadata/32171/thumb/-1", + parentThumb: "/library/metadata/32170/thumb/1654134301", + grandparentThumb: "/library/metadata/32132/thumb/1703933346", + grandparentArt: "/library/metadata/32132/art/1703933346", + index: 1, + parentIndex: 13, + originallyAvailableAt: new RFCDate("2022-04-14T00:00:00Z"), + viewedAt: 1654139223, + accountID: 1, + deviceID: 5, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getsessionhistoryresponsebody.md b/docs/models/getsessionhistoryresponsebody.md index edaee636..e9651be7 100644 --- a/docs/models/getsessionhistoryresponsebody.md +++ b/docs/models/getsessionhistoryresponsebody.md @@ -2,6 +2,41 @@ List of Plex Sessions +## Example Usage + +```typescript +import { GetSessionHistoryResponseBody } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetSessionHistoryResponseBody = { + mediaContainer: { + size: 10855, + metadata: [ + { + historyKey: "/status/sessions/history/1", + key: "/library/metadata/32171", + ratingKey: "32171", + librarySectionID: "2", + parentKey: "/library/metadata/32170", + grandparentKey: "/library/metadata/32132", + title: "The Noise That Blue Makes", + grandparentTitle: "Taskmaster", + type: "episode", + thumb: "/library/metadata/32171/thumb/-1", + parentThumb: "/library/metadata/32170/thumb/1654134301", + grandparentThumb: "/library/metadata/32132/thumb/1703933346", + grandparentArt: "/library/metadata/32132/art/1703933346", + index: 1, + parentIndex: 13, + originallyAvailableAt: new RFCDate("2022-04-14T00:00:00Z"), + viewedAt: 1654139223, + accountID: 1, + deviceID: 5, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getsessionhistorysessionsresponsebody.md b/docs/models/getsessionhistorysessionsresponsebody.md index 01caa5a6..901427d9 100644 --- a/docs/models/getsessionhistorysessionsresponsebody.md +++ b/docs/models/getsessionhistorysessionsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetSessionHistorySessionsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getsessionserrors.md b/docs/models/getsessionserrors.md index bc4f1281..7caac780 100644 --- a/docs/models/getsessionserrors.md +++ b/docs/models/getsessionserrors.md @@ -1,5 +1,16 @@ # GetSessionsErrors +## Example Usage + +```typescript +import { GetSessionsErrors } from "@lukehagar/plexjs"; + +let value: GetSessionsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getsessionsmedia.md b/docs/models/getsessionsmedia.md index 844d06ac..d69ff499 100644 --- a/docs/models/getsessionsmedia.md +++ b/docs/models/getsessionsmedia.md @@ -1,5 +1,57 @@ # GetSessionsMedia +## Example Usage + +```typescript +import { GetSessionsMedia } from "@lukehagar/plexjs"; + +let value: GetSessionsMedia = { + audioChannels: 2, + audioCodec: "flac", + bitrate: 1014, + container: "flac", + duration: 186240, + id: "130355", + selected: true, + part: [ + { + container: "flac", + duration: 186240, + file: "/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac", + hasThumbnail: "1", + id: "130625", + key: "/library/parts/130625/1705543268/file.flac", + size: 23644000, + decision: "directplay", + selected: true, + stream: [ + { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsessionsmediacontainer.md b/docs/models/getsessionsmediacontainer.md index 6a8bfcd2..03988b2e 100644 --- a/docs/models/getsessionsmediacontainer.md +++ b/docs/models/getsessionsmediacontainer.md @@ -1,5 +1,126 @@ # GetSessionsMediaContainer +## Example Usage + +```typescript +import { GetSessionsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetSessionsMediaContainer = { + size: 1, + metadata: [ + { + addedAt: 1705543312, + art: "/library/metadata/39904/art/1705310687", + duration: 186240, + grandparentArt: "/library/metadata/39904/art/1705310687", + grandparentGuid: "plex://artist/5d07bbfd403c6402904a6480", + grandparentKey: "/library/metadata/39904", + grandparentRatingKey: "39904", + grandparentThumb: "/library/metadata/39904/thumb/1705310687", + grandparentTitle: "Green Day", + guid: "plex://track/6535834f71f22f36f71a8e8f", + index: 1, + key: "/library/metadata/67085", + librarySectionID: "3", + librarySectionKey: "/library/sections/3", + librarySectionTitle: "Music", + musicAnalysisVersion: "1", + parentGuid: "plex://album/65394d6d472b8ab03ef47f12", + parentIndex: 1, + parentKey: "/library/metadata/67084", + parentRatingKey: "67084", + parentStudio: "Reprise Records", + parentThumb: "/library/metadata/67084/thumb/1705543314", + parentTitle: "Saviors", + parentYear: 2024, + ratingCount: 45885, + ratingKey: "67085", + sessionKey: "203", + thumb: "/library/metadata/67084/thumb/1705543314", + title: "The American Dream Is Killing Me", + titleSort: "American Dream Is Killing Me", + type: "track", + updatedAt: 1705543314, + viewOffset: 1000, + media: [ + { + audioChannels: 2, + audioCodec: "flac", + bitrate: 1014, + container: "flac", + duration: 186240, + id: "130355", + selected: true, + part: [ + { + container: "flac", + duration: 186240, + file: "/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac", + hasThumbnail: "1", + id: "130625", + key: "/library/parts/130625/1705543268/file.flac", + size: 23644000, + decision: "directplay", + selected: true, + stream: [ + { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", + }, + ], + }, + ], + }, + ], + user: { + id: "1", + thumb: "https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661", + title: "Blindkitty38", + }, + player: { + address: "10.10.10.171", + machineIdentifier: "3tsdzir85m2onc3qyr255aq1", + model: "standalone", + platform: "windows", + platformVersion: "10.0.22621", + product: "Plex for Windows", + profile: "Plex Desktop", + remotePublicAddress: "68.248.140.20", + state: "playing", + title: "DESKTOP-BL80MTD", + version: "1.85.0.4071-21128b56", + local: true, + relayed: false, + secure: true, + userID: 1, + }, + session: { + id: "93h7e00ncblxncqw9lkfaoxi", + bandwidth: 1050, + location: "lan", + }, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsessionsmetadata.md b/docs/models/getsessionsmetadata.md index 2bcad40b..5ce80301 100644 --- a/docs/models/getsessionsmetadata.md +++ b/docs/models/getsessionsmetadata.md @@ -1,5 +1,121 @@ # GetSessionsMetadata +## Example Usage + +```typescript +import { GetSessionsMetadata } from "@lukehagar/plexjs"; + +let value: GetSessionsMetadata = { + addedAt: 1705543312, + art: "/library/metadata/39904/art/1705310687", + duration: 186240, + grandparentArt: "/library/metadata/39904/art/1705310687", + grandparentGuid: "plex://artist/5d07bbfd403c6402904a6480", + grandparentKey: "/library/metadata/39904", + grandparentRatingKey: "39904", + grandparentThumb: "/library/metadata/39904/thumb/1705310687", + grandparentTitle: "Green Day", + guid: "plex://track/6535834f71f22f36f71a8e8f", + index: 1, + key: "/library/metadata/67085", + librarySectionID: "3", + librarySectionKey: "/library/sections/3", + librarySectionTitle: "Music", + musicAnalysisVersion: "1", + parentGuid: "plex://album/65394d6d472b8ab03ef47f12", + parentIndex: 1, + parentKey: "/library/metadata/67084", + parentRatingKey: "67084", + parentStudio: "Reprise Records", + parentThumb: "/library/metadata/67084/thumb/1705543314", + parentTitle: "Saviors", + parentYear: 2024, + ratingCount: 45885, + ratingKey: "67085", + sessionKey: "203", + thumb: "/library/metadata/67084/thumb/1705543314", + title: "The American Dream Is Killing Me", + titleSort: "American Dream Is Killing Me", + type: "track", + updatedAt: 1705543314, + viewOffset: 1000, + media: [ + { + audioChannels: 2, + audioCodec: "flac", + bitrate: 1014, + container: "flac", + duration: 186240, + id: "130355", + selected: true, + part: [ + { + container: "flac", + duration: 186240, + file: "/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac", + hasThumbnail: "1", + id: "130625", + key: "/library/parts/130625/1705543268/file.flac", + size: 23644000, + decision: "directplay", + selected: true, + stream: [ + { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", + }, + ], + }, + ], + }, + ], + user: { + id: "1", + thumb: "https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661", + title: "Blindkitty38", + }, + player: { + address: "10.10.10.171", + machineIdentifier: "3tsdzir85m2onc3qyr255aq1", + model: "standalone", + platform: "windows", + platformVersion: "10.0.22621", + product: "Plex for Windows", + profile: "Plex Desktop", + remotePublicAddress: "68.248.140.20", + state: "playing", + title: "DESKTOP-BL80MTD", + version: "1.85.0.4071-21128b56", + local: true, + relayed: false, + secure: true, + userID: 1, + }, + session: { + id: "93h7e00ncblxncqw9lkfaoxi", + bandwidth: 1050, + location: "lan", + }, +}; +``` ## Fields diff --git a/docs/models/getsessionspart.md b/docs/models/getsessionspart.md index f67b0269..3be41a7f 100644 --- a/docs/models/getsessionspart.md +++ b/docs/models/getsessionspart.md @@ -1,5 +1,46 @@ # GetSessionsPart +## Example Usage + +```typescript +import { GetSessionsPart } from "@lukehagar/plexjs"; + +let value: GetSessionsPart = { + container: "flac", + duration: 186240, + file: "/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac", + hasThumbnail: "1", + id: "130625", + key: "/library/parts/130625/1705543268/file.flac", + size: 23644000, + decision: "directplay", + selected: true, + stream: [ + { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getsessionsresponse.md b/docs/models/getsessionsresponse.md index a49efbd2..86a2e512 100644 --- a/docs/models/getsessionsresponse.md +++ b/docs/models/getsessionsresponse.md @@ -1,5 +1,135 @@ # GetSessionsResponse +## Example Usage + +```typescript +import { GetSessionsResponse } from "@lukehagar/plexjs"; + +let value: GetSessionsResponse = { + contentType: "", + statusCode: 158969, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + metadata: [ + { + addedAt: 1705543312, + art: "/library/metadata/39904/art/1705310687", + duration: 186240, + grandparentArt: "/library/metadata/39904/art/1705310687", + grandparentGuid: "plex://artist/5d07bbfd403c6402904a6480", + grandparentKey: "/library/metadata/39904", + grandparentRatingKey: "39904", + grandparentThumb: "/library/metadata/39904/thumb/1705310687", + grandparentTitle: "Green Day", + guid: "plex://track/6535834f71f22f36f71a8e8f", + index: 1, + key: "/library/metadata/67085", + librarySectionID: "3", + librarySectionKey: "/library/sections/3", + librarySectionTitle: "Music", + musicAnalysisVersion: "1", + parentGuid: "plex://album/65394d6d472b8ab03ef47f12", + parentIndex: 1, + parentKey: "/library/metadata/67084", + parentRatingKey: "67084", + parentStudio: "Reprise Records", + parentThumb: "/library/metadata/67084/thumb/1705543314", + parentTitle: "Saviors", + parentYear: 2024, + ratingCount: 45885, + ratingKey: "67085", + sessionKey: "203", + thumb: "/library/metadata/67084/thumb/1705543314", + title: "The American Dream Is Killing Me", + titleSort: "American Dream Is Killing Me", + type: "track", + updatedAt: 1705543314, + viewOffset: 1000, + media: [ + { + audioChannels: 2, + audioCodec: "flac", + bitrate: 1014, + container: "flac", + duration: 186240, + id: "130355", + selected: true, + part: [ + { + container: "flac", + duration: 186240, + file: "/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac", + hasThumbnail: "1", + id: "130625", + key: "/library/parts/130625/1705543268/file.flac", + size: 23644000, + decision: "directplay", + selected: true, + stream: [ + { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", + }, + ], + }, + ], + }, + ], + user: { + id: "1", + thumb: "https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661", + title: "Blindkitty38", + }, + player: { + address: "10.10.10.171", + machineIdentifier: "3tsdzir85m2onc3qyr255aq1", + model: "standalone", + platform: "windows", + platformVersion: "10.0.22621", + product: "Plex for Windows", + profile: "Plex Desktop", + remotePublicAddress: "68.248.140.20", + state: "playing", + title: "DESKTOP-BL80MTD", + version: "1.85.0.4071-21128b56", + local: true, + relayed: false, + secure: true, + userID: 1, + }, + session: { + id: "93h7e00ncblxncqw9lkfaoxi", + bandwidth: 1050, + location: "lan", + }, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getsessionsresponsebody.md b/docs/models/getsessionsresponsebody.md index 99938c57..33fef891 100644 --- a/docs/models/getsessionsresponsebody.md +++ b/docs/models/getsessionsresponsebody.md @@ -2,6 +2,129 @@ List of Active Plex Sessions +## Example Usage + +```typescript +import { GetSessionsResponseBody } from "@lukehagar/plexjs"; + +let value: GetSessionsResponseBody = { + mediaContainer: { + size: 1, + metadata: [ + { + addedAt: 1705543312, + art: "/library/metadata/39904/art/1705310687", + duration: 186240, + grandparentArt: "/library/metadata/39904/art/1705310687", + grandparentGuid: "plex://artist/5d07bbfd403c6402904a6480", + grandparentKey: "/library/metadata/39904", + grandparentRatingKey: "39904", + grandparentThumb: "/library/metadata/39904/thumb/1705310687", + grandparentTitle: "Green Day", + guid: "plex://track/6535834f71f22f36f71a8e8f", + index: 1, + key: "/library/metadata/67085", + librarySectionID: "3", + librarySectionKey: "/library/sections/3", + librarySectionTitle: "Music", + musicAnalysisVersion: "1", + parentGuid: "plex://album/65394d6d472b8ab03ef47f12", + parentIndex: 1, + parentKey: "/library/metadata/67084", + parentRatingKey: "67084", + parentStudio: "Reprise Records", + parentThumb: "/library/metadata/67084/thumb/1705543314", + parentTitle: "Saviors", + parentYear: 2024, + ratingCount: 45885, + ratingKey: "67085", + sessionKey: "203", + thumb: "/library/metadata/67084/thumb/1705543314", + title: "The American Dream Is Killing Me", + titleSort: "American Dream Is Killing Me", + type: "track", + updatedAt: 1705543314, + viewOffset: 1000, + media: [ + { + audioChannels: 2, + audioCodec: "flac", + bitrate: 1014, + container: "flac", + duration: 186240, + id: "130355", + selected: true, + part: [ + { + container: "flac", + duration: 186240, + file: "/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac", + hasThumbnail: "1", + id: "130625", + key: "/library/parts/130625/1705543268/file.flac", + size: 23644000, + decision: "directplay", + selected: true, + stream: [ + { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", + }, + ], + }, + ], + }, + ], + user: { + id: "1", + thumb: "https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661", + title: "Blindkitty38", + }, + player: { + address: "10.10.10.171", + machineIdentifier: "3tsdzir85m2onc3qyr255aq1", + model: "standalone", + platform: "windows", + platformVersion: "10.0.22621", + product: "Plex for Windows", + profile: "Plex Desktop", + remotePublicAddress: "68.248.140.20", + state: "playing", + title: "DESKTOP-BL80MTD", + version: "1.85.0.4071-21128b56", + local: true, + relayed: false, + secure: true, + userID: 1, + }, + session: { + id: "93h7e00ncblxncqw9lkfaoxi", + bandwidth: 1050, + location: "lan", + }, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getsessionssessionsresponsebody.md b/docs/models/getsessionssessionsresponsebody.md index 91a12d7e..c49fe013 100644 --- a/docs/models/getsessionssessionsresponsebody.md +++ b/docs/models/getsessionssessionsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetSessionsSessionsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getsessionsstream.md b/docs/models/getsessionsstream.md index 82a20b29..5647bba7 100644 --- a/docs/models/getsessionsstream.md +++ b/docs/models/getsessionsstream.md @@ -1,5 +1,33 @@ # GetSessionsStream +## Example Usage + +```typescript +import { GetSessionsStream } from "@lukehagar/plexjs"; + +let value: GetSessionsStream = { + albumGain: "-12.94", + albumPeak: "1.000000", + albumRange: "4.751014", + audioChannelLayout: "stereo", + bitDepth: 16, + bitrate: 1014, + channels: 2, + codec: "flac", + displayTitle: "FLAC (Stereo)", + extendedDisplayTitle: "FLAC (Stereo)", + gain: "-12.94", + id: "352487", + index: 0, + loudness: "-5.94", + lra: "1.74", + peak: "1.000000", + samplingRate: 44100, + selected: true, + streamType: 2, + location: "direct", +}; +``` ## Fields diff --git a/docs/models/getsessionsuser.md b/docs/models/getsessionsuser.md index 6f0021f2..982af662 100644 --- a/docs/models/getsessionsuser.md +++ b/docs/models/getsessionsuser.md @@ -1,5 +1,16 @@ # GetSessionsUser +## Example Usage + +```typescript +import { GetSessionsUser } from "@lukehagar/plexjs"; + +let value: GetSessionsUser = { + id: "1", + thumb: "https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661", + title: "Blindkitty38", +}; +``` ## Fields diff --git a/docs/models/getsourceconnectioninformationerrors.md b/docs/models/getsourceconnectioninformationerrors.md index b605fd63..642f7864 100644 --- a/docs/models/getsourceconnectioninformationerrors.md +++ b/docs/models/getsourceconnectioninformationerrors.md @@ -1,5 +1,16 @@ # GetSourceConnectionInformationErrors +## Example Usage + +```typescript +import { GetSourceConnectionInformationErrors } from "@lukehagar/plexjs"; + +let value: GetSourceConnectionInformationErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getsourceconnectioninformationrequest.md b/docs/models/getsourceconnectioninformationrequest.md index 64fdbc4b..30b2603b 100644 --- a/docs/models/getsourceconnectioninformationrequest.md +++ b/docs/models/getsourceconnectioninformationrequest.md @@ -1,5 +1,14 @@ # GetSourceConnectionInformationRequest +## Example Usage + +```typescript +import { GetSourceConnectionInformationRequest } from "@lukehagar/plexjs"; + +let value: GetSourceConnectionInformationRequest = { + source: "server://client-identifier", +}; +``` ## Fields diff --git a/docs/models/getsourceconnectioninformationresponse.md b/docs/models/getsourceconnectioninformationresponse.md index f27e12f9..98fc1634 100644 --- a/docs/models/getsourceconnectioninformationresponse.md +++ b/docs/models/getsourceconnectioninformationresponse.md @@ -1,5 +1,18 @@ # GetSourceConnectionInformationResponse +## Example Usage + +```typescript +import { GetSourceConnectionInformationResponse } from "@lukehagar/plexjs"; + +let value: GetSourceConnectionInformationResponse = { + contentType: "", + statusCode: 466311, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/getsourceconnectioninformationresponsebody.md b/docs/models/getsourceconnectioninformationresponsebody.md index f9a3ba53..d1b58cfd 100644 --- a/docs/models/getsourceconnectioninformationresponsebody.md +++ b/docs/models/getsourceconnectioninformationresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetSourceConnectionInformationResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getstatisticsdevice.md b/docs/models/getstatisticsdevice.md index bd334139..90666044 100644 --- a/docs/models/getstatisticsdevice.md +++ b/docs/models/getstatisticsdevice.md @@ -1,5 +1,18 @@ # GetStatisticsDevice +## Example Usage + +```typescript +import { GetStatisticsDevice } from "@lukehagar/plexjs"; + +let value: GetStatisticsDevice = { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, +}; +``` ## Fields diff --git a/docs/models/getstatisticserrors.md b/docs/models/getstatisticserrors.md index f599941b..d9761d27 100644 --- a/docs/models/getstatisticserrors.md +++ b/docs/models/getstatisticserrors.md @@ -1,5 +1,16 @@ # GetStatisticsErrors +## Example Usage + +```typescript +import { GetStatisticsErrors } from "@lukehagar/plexjs"; + +let value: GetStatisticsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getstatisticsmediacontainer.md b/docs/models/getstatisticsmediacontainer.md index f148c68a..b87c4240 100644 --- a/docs/models/getstatisticsmediacontainer.md +++ b/docs/models/getstatisticsmediacontainer.md @@ -1,5 +1,46 @@ # GetStatisticsMediaContainer +## Example Usage + +```typescript +import { GetStatisticsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetStatisticsMediaContainer = { + size: 5497, + device: [ + { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, + }, + ], + account: [ + { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", + }, + ], + statisticsMedia: [ + { + accountID: 1, + deviceID: 13, + timespan: 4, + at: 1707141600, + metadataType: 4, + count: 1, + duration: 1555, + }, + ], +}; +``` ## Fields diff --git a/docs/models/getstatisticsrequest.md b/docs/models/getstatisticsrequest.md index e8bbb8a8..3378fbf9 100644 --- a/docs/models/getstatisticsrequest.md +++ b/docs/models/getstatisticsrequest.md @@ -1,5 +1,14 @@ # GetStatisticsRequest +## Example Usage + +```typescript +import { GetStatisticsRequest } from "@lukehagar/plexjs"; + +let value: GetStatisticsRequest = { + timespan: 4, +}; +``` ## Fields diff --git a/docs/models/getstatisticsresponse.md b/docs/models/getstatisticsresponse.md index c8c69e91..114e02a8 100644 --- a/docs/models/getstatisticsresponse.md +++ b/docs/models/getstatisticsresponse.md @@ -1,5 +1,55 @@ # GetStatisticsResponse +## Example Usage + +```typescript +import { GetStatisticsResponse } from "@lukehagar/plexjs"; + +let value: GetStatisticsResponse = { + contentType: "", + statusCode: 474697, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 5497, + device: [ + { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, + }, + ], + account: [ + { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", + }, + ], + statisticsMedia: [ + { + accountID: 1, + deviceID: 13, + timespan: 4, + at: 1707141600, + metadataType: 4, + count: 1, + duration: 1555, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getstatisticsresponsebody.md b/docs/models/getstatisticsresponsebody.md index a7755348..20bcc272 100644 --- a/docs/models/getstatisticsresponsebody.md +++ b/docs/models/getstatisticsresponsebody.md @@ -2,6 +2,49 @@ Media Statistics +## Example Usage + +```typescript +import { GetStatisticsResponseBody } from "@lukehagar/plexjs"; + +let value: GetStatisticsResponseBody = { + mediaContainer: { + size: 5497, + device: [ + { + id: 208, + name: "Roku Express", + platform: "Roku", + clientIdentifier: "793095d235660625108ef785cc7646e9", + createdAt: 1706470556, + }, + ], + account: [ + { + id: 238960586, + key: "/accounts/238960586", + name: "Diane", + defaultAudioLanguage: "en", + autoSelectAudio: true, + defaultSubtitleLanguage: "en", + subtitleMode: 1, + thumb: "https://plex.tv/users/50d83634246da1de/avatar?c=1707110967", + }, + ], + statisticsMedia: [ + { + accountID: 1, + deviceID: 13, + timespan: 4, + at: 1707141600, + metadataType: 4, + count: 1, + duration: 1555, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getstatisticsstatisticsresponsebody.md b/docs/models/getstatisticsstatisticsresponsebody.md index e32a79f4..286d76a1 100644 --- a/docs/models/getstatisticsstatisticsresponsebody.md +++ b/docs/models/getstatisticsstatisticsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetStatisticsStatisticsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/gettimelineerrors.md b/docs/models/gettimelineerrors.md index dae4e113..9f70eba1 100644 --- a/docs/models/gettimelineerrors.md +++ b/docs/models/gettimelineerrors.md @@ -1,5 +1,16 @@ # GetTimelineErrors +## Example Usage + +```typescript +import { GetTimelineErrors } from "@lukehagar/plexjs"; + +let value: GetTimelineErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/gettimelinerequest.md b/docs/models/gettimelinerequest.md index 5fc132c0..89eae24e 100644 --- a/docs/models/gettimelinerequest.md +++ b/docs/models/gettimelinerequest.md @@ -1,5 +1,23 @@ # GetTimelineRequest +## Example Usage + +```typescript +import { GetTimelineRequest, State } from "@lukehagar/plexjs"; + +let value: GetTimelineRequest = { + ratingKey: 23409, + key: "/library/metadata/23409", + state: State.Playing, + hasMDE: 1, + time: 2000, + duration: 10000, + context: "home:hub.continueWatching", + playQueueItemID: 1, + playBackTime: 2000, + row: 1, +}; +``` ## Fields diff --git a/docs/models/gettimelineresponse.md b/docs/models/gettimelineresponse.md index 1cc4ac1c..015d0fc4 100644 --- a/docs/models/gettimelineresponse.md +++ b/docs/models/gettimelineresponse.md @@ -1,5 +1,18 @@ # GetTimelineResponse +## Example Usage + +```typescript +import { GetTimelineResponse } from "@lukehagar/plexjs"; + +let value: GetTimelineResponse = { + contentType: "", + statusCode: 963663, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/gettimelineresponsebody.md b/docs/models/gettimelineresponsebody.md index 7bc3b9ce..994b8bab 100644 --- a/docs/models/gettimelineresponsebody.md +++ b/docs/models/gettimelineresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetTimelineResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/gettokenbypinidauthpincontainer.md b/docs/models/gettokenbypinidauthpincontainer.md new file mode 100644 index 00000000..67e445ad --- /dev/null +++ b/docs/models/gettokenbypinidauthpincontainer.md @@ -0,0 +1,53 @@ +# GetTokenByPinIdAuthPinContainer + +The Pin with a non-null authToken when it has been verified by the user + +## Example Usage + +```typescript +import { GetTokenByPinIdAuthPinContainer } from "@lukehagar/plexjs"; + +let value: GetTokenByPinIdAuthPinContainer = { + id: 308667304, + code: "7RQZ", + product: "0", + trusted: false, + qr: "https://plex.tv/api/v2/pins/qr/7RQZ", + clientIdentifier: "string", + location: { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", + }, + expiresIn: 876, + createdAt: new Date("2024-07-16T17:03:05Z"), + expiresAt: new Date("2024-07-16T17:18:05Z"), + authToken: null, + newRegistration: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *number* | :heavy_check_mark: | N/A | 308667304 | +| `code` | *string* | :heavy_check_mark: | N/A | 7RQZ | +| `product` | *string* | :heavy_check_mark: | N/A | 0 | +| `trusted` | *boolean* | :heavy_minus_sign: | N/A | | +| `qr` | *string* | :heavy_check_mark: | N/A | https://plex.tv/api/v2/pins/qr/7RQZ | +| `clientIdentifier` | *string* | :heavy_check_mark: | The X-Client-Identifier used in the request | | +| `location` | [models.GetTokenByPinIdGeoData](../models/gettokenbypinidgeodata.md) | :heavy_check_mark: | Geo location data | {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
} | +| `expiresIn` | *number* | :heavy_minus_sign: | The number of seconds this pin expires, by default 900 seconds | 876 | +| `createdAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-07-16T17:03:05Z | +| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-07-16T17:18:05Z | +| `authToken` | *any* | :heavy_minus_sign: | N/A | | +| `newRegistration` | *any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/gettokenbypiniderrors.md b/docs/models/gettokenbypiniderrors.md new file mode 100644 index 00000000..146966ee --- /dev/null +++ b/docs/models/gettokenbypiniderrors.md @@ -0,0 +1,19 @@ +# GetTokenByPinIdErrors + +## Example Usage + +```typescript +import { GetTokenByPinIdErrors } from "@lukehagar/plexjs"; + +let value: GetTokenByPinIdErrors = { + code: 1020, + message: "Code not found or expired", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1020 | +| `message` | *string* | :heavy_minus_sign: | N/A | Code not found or expired | \ No newline at end of file diff --git a/docs/models/gettokenbypinidgeodata.md b/docs/models/gettokenbypinidgeodata.md new file mode 100644 index 00000000..26bc6df1 --- /dev/null +++ b/docs/models/gettokenbypinidgeodata.md @@ -0,0 +1,39 @@ +# GetTokenByPinIdGeoData + +Geo location data + +## Example Usage + +```typescript +import { GetTokenByPinIdGeoData } from "@lukehagar/plexjs"; + +let value: GetTokenByPinIdGeoData = { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `code` | *string* | :heavy_check_mark: | The ISO 3166-1 alpha-2 code of the country. | VI | +| `continentCode` | *string* | :heavy_check_mark: | The continent code where the country is located. | NA | +| `country` | *string* | :heavy_check_mark: | The official name of the country. | United States Virgin Islands | +| `city` | *string* | :heavy_check_mark: | The name of the city. | Amsterdam | +| `europeanUnionMember` | *boolean* | :heavy_minus_sign: | Indicates if the country is a member of the European Union. | true | +| `timeZone` | *string* | :heavy_check_mark: | The time zone of the country. | America/St_Thomas | +| `postalCode` | *number* | :heavy_check_mark: | The postal code of the location. | 802 | +| `inPrivacyRestrictedCountry` | *boolean* | :heavy_minus_sign: | Indicates if the country has privacy restrictions. | true | +| `inPrivacyRestrictedRegion` | *boolean* | :heavy_minus_sign: | Indicates if the region has privacy restrictions. | true | +| `subdivisions` | *string* | :heavy_check_mark: | The name of the primary administrative subdivision. | Saint Thomas | +| `coordinates` | *string* | :heavy_check_mark: | The geographical coordinates (latitude, longitude) of the location. | 18.3381, -64.8941 | \ No newline at end of file diff --git a/docs/models/gettokenbypinidglobals.md b/docs/models/gettokenbypinidglobals.md new file mode 100644 index 00000000..8246fc6b --- /dev/null +++ b/docs/models/gettokenbypinidglobals.md @@ -0,0 +1,15 @@ +# GetTokenByPinIdGlobals + +## Example Usage + +```typescript +import { GetTokenByPinIdGlobals } from "@lukehagar/plexjs"; + +let value: GetTokenByPinIdGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file diff --git a/docs/models/gettokenrequest.md b/docs/models/gettokenbypinidrequest.md similarity index 92% rename from docs/models/gettokenrequest.md rename to docs/models/gettokenbypinidrequest.md index b970a65f..2fd42701 100644 --- a/docs/models/gettokenrequest.md +++ b/docs/models/gettokenbypinidrequest.md @@ -1,9 +1,18 @@ -# GetTokenRequest +# GetTokenByPinIdRequest +## Example Usage + +```typescript +import { GetTokenByPinIdRequest } from "@lukehagar/plexjs"; + +let value: GetTokenByPinIdRequest = { + pinID: 800911, +}; +``` ## Fields | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for | | -| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | +| `pinID` | *number* | :heavy_check_mark: | The PinID to retrieve an access token for | | \ No newline at end of file diff --git a/docs/models/gettokenbypinidresponse.md b/docs/models/gettokenbypinidresponse.md new file mode 100644 index 00000000..5bead11f --- /dev/null +++ b/docs/models/gettokenbypinidresponse.md @@ -0,0 +1,50 @@ +# GetTokenByPinIdResponse + +## Example Usage + +```typescript +import { GetTokenByPinIdResponse } from "@lukehagar/plexjs"; + +let value: GetTokenByPinIdResponse = { + contentType: "", + statusCode: 461479, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + authPinContainer: { + id: 308667304, + code: "7RQZ", + product: "0", + trusted: false, + qr: "https://plex.tv/api/v2/pins/qr/7RQZ", + clientIdentifier: "string", + location: { + code: "VI", + continentCode: "NA", + country: "United States Virgin Islands", + city: "Amsterdam", + europeanUnionMember: true, + timeZone: "America/St_Thomas", + postalCode: 802, + inPrivacyRestrictedCountry: true, + inPrivacyRestrictedRegion: true, + subdivisions: "Saint Thomas", + coordinates: "18.3381, -64.8941", + }, + expiresIn: 876, + createdAt: new Date("2024-07-16T17:03:05Z"), + expiresAt: new Date("2024-07-16T17:18:05Z"), + authToken: null, + newRegistration: null, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `authPinContainer` | [models.GetTokenByPinIdAuthPinContainer](../models/gettokenbypinidauthpincontainer.md) | :heavy_minus_sign: | The Pin with a non-null authToken when it has been verified by the user | {
"id": 308667304,
"code": "7RQZ",
"product": "0",
"trusted": false,
"qr": "https://plex.tv/api/v2/pins/qr/7RQZ",
"clientIdentifier": "string",
"location": {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
},
"expiresIn": 876,
"createdAt": "2024-07-16T17:03:05Z",
"expiresAt": "2024-07-16T17:18:05Z",
"authToken": null,
"newRegistration": null
} | \ No newline at end of file diff --git a/docs/models/gettokenplexresponsebody.md b/docs/models/gettokenbypinidresponsebody.md similarity index 76% rename from docs/models/gettokenplexresponsebody.md rename to docs/models/gettokenbypinidresponsebody.md index 74fa8124..03c95c58 100644 --- a/docs/models/gettokenplexresponsebody.md +++ b/docs/models/gettokenbypinidresponsebody.md @@ -1,11 +1,18 @@ -# GetTokenPlexResponseBody +# GetTokenByPinIdResponseBody -X-Plex-Client-Identifier is missing +Not Found or Expired +## Example Usage + +```typescript +import { GetTokenByPinIdResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields | Field | Type | Required | Description | | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `errors` | [models.GetTokenErrors](../models/gettokenerrors.md)[] | :heavy_minus_sign: | N/A | +| `errors` | [models.GetTokenByPinIdErrors](../models/gettokenbypiniderrors.md)[] | :heavy_minus_sign: | N/A | | `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/gettokenerrors.md b/docs/models/gettokenerrors.md deleted file mode 100644 index a8a7ae04..00000000 --- a/docs/models/gettokenerrors.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetTokenErrors - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `code` | *number* | :heavy_minus_sign: | N/A | 1000 | -| `message` | *string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | -| `status` | *number* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/gettokenlocation.md b/docs/models/gettokenlocation.md deleted file mode 100644 index d192f7f1..00000000 --- a/docs/models/gettokenlocation.md +++ /dev/null @@ -1,17 +0,0 @@ -# GetTokenLocation - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | -| `code` | *string* | :heavy_minus_sign: | N/A | US | -| `europeanUnionMember` | *boolean* | :heavy_minus_sign: | N/A | | -| `continentCode` | *string* | :heavy_minus_sign: | N/A | NA | -| `country` | *string* | :heavy_minus_sign: | N/A | United States | -| `city` | *string* | :heavy_minus_sign: | N/A | Austin | -| `timeZone` | *string* | :heavy_minus_sign: | N/A | America/Chicago | -| `postalCode` | *string* | :heavy_minus_sign: | N/A | 78732 | -| `inPrivacyRestrictedCountry` | *boolean* | :heavy_minus_sign: | N/A | | -| `subdivisions` | *string* | :heavy_minus_sign: | N/A | Texas | -| `coordinates` | *string* | :heavy_minus_sign: | N/A | 30.3768 -97.8935 | \ No newline at end of file diff --git a/docs/models/gettopwatchedcontentcountry.md b/docs/models/gettopwatchedcontentcountry.md index 25bb1d39..cc2839f4 100644 --- a/docs/models/gettopwatchedcontentcountry.md +++ b/docs/models/gettopwatchedcontentcountry.md @@ -1,5 +1,16 @@ # GetTopWatchedContentCountry +## Example Usage + +```typescript +import { GetTopWatchedContentCountry } from "@lukehagar/plexjs"; + +let value: GetTopWatchedContentCountry = { + id: 116, + filter: "country=116", + tag: "United States of America", +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentgenre.md b/docs/models/gettopwatchedcontentgenre.md index 920fd772..cfa71f7c 100644 --- a/docs/models/gettopwatchedcontentgenre.md +++ b/docs/models/gettopwatchedcontentgenre.md @@ -1,5 +1,16 @@ # GetTopWatchedContentGenre +## Example Usage + +```typescript +import { GetTopWatchedContentGenre } from "@lukehagar/plexjs"; + +let value: GetTopWatchedContentGenre = { + id: 184, + filter: "genre=184", + tag: "Thriller", +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentguids.md b/docs/models/gettopwatchedcontentguids.md index 0e273656..024a9650 100644 --- a/docs/models/gettopwatchedcontentguids.md +++ b/docs/models/gettopwatchedcontentguids.md @@ -1,5 +1,14 @@ # GetTopWatchedContentGuids +## Example Usage + +```typescript +import { GetTopWatchedContentGuids } from "@lukehagar/plexjs"; + +let value: GetTopWatchedContentGuids = { + id: "tvdb://2337", +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentmediacontainer.md b/docs/models/gettopwatchedcontentmediacontainer.md index 0c3b75a7..777f81d8 100644 --- a/docs/models/gettopwatchedcontentmediacontainer.md +++ b/docs/models/gettopwatchedcontentmediacontainer.md @@ -1,5 +1,85 @@ # GetTopWatchedContentMediaContainer +## Example Usage + +```typescript +import { GetTopWatchedContentMediaContainer } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetTopWatchedContentMediaContainer = { + size: 1, + allowSync: true, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + slug: "waterloo-road", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + index: 1, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + leafCount: 222, + viewedLeafCount: 100, + childCount: 13, + addedAt: 1705637164, + updatedAt: 1705637165, + globalViewCount: 80, + audienceRatingImage: "rottentomatoes://image.rating.upright", + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + user: [ + { + id: 220, + }, + ], + }, + ], +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentmetadata.md b/docs/models/gettopwatchedcontentmetadata.md index 9f530ab7..c4288e70 100644 --- a/docs/models/gettopwatchedcontentmetadata.md +++ b/docs/models/gettopwatchedcontentmetadata.md @@ -1,5 +1,76 @@ # GetTopWatchedContentMetadata +## Example Usage + +```typescript +import { GetTopWatchedContentMetadata } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetTopWatchedContentMetadata = { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + slug: "waterloo-road", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + index: 1, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + leafCount: 222, + viewedLeafCount: 100, + childCount: 13, + addedAt: 1705637164, + updatedAt: 1705637165, + globalViewCount: 80, + audienceRatingImage: "rottentomatoes://image.rating.upright", + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + user: [ + { + id: 220, + }, + ], +}; +``` ## Fields @@ -36,4 +107,4 @@ | `country` | [models.GetTopWatchedContentCountry](../models/gettopwatchedcontentcountry.md)[] | :heavy_minus_sign: | N/A | | | `guids` | [models.GetTopWatchedContentGuids](../models/gettopwatchedcontentguids.md)[] | :heavy_minus_sign: | N/A | | | `role` | [models.GetTopWatchedContentRole](../models/gettopwatchedcontentrole.md)[] | :heavy_minus_sign: | N/A | | -| `user` | [models.User](../models/user.md)[] | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `user` | [models.GetTopWatchedContentUser](../models/gettopwatchedcontentuser.md)[] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/gettopwatchedcontentrequest.md b/docs/models/gettopwatchedcontentrequest.md index 25d50339..d1457dca 100644 --- a/docs/models/gettopwatchedcontentrequest.md +++ b/docs/models/gettopwatchedcontentrequest.md @@ -1,5 +1,15 @@ # GetTopWatchedContentRequest +## Example Usage + +```typescript +import { GetTopWatchedContentRequest } from "@lukehagar/plexjs"; + +let value: GetTopWatchedContentRequest = { + type: 681820, + includeGuids: 1, +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentresponse.md b/docs/models/gettopwatchedcontentresponse.md index 67281683..650904f0 100644 --- a/docs/models/gettopwatchedcontentresponse.md +++ b/docs/models/gettopwatchedcontentresponse.md @@ -1,5 +1,94 @@ # GetTopWatchedContentResponse +## Example Usage + +```typescript +import { GetTopWatchedContentResponse } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetTopWatchedContentResponse = { + contentType: "", + statusCode: 449950, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + allowSync: true, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + slug: "waterloo-road", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + index: 1, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + leafCount: 222, + viewedLeafCount: 100, + childCount: 13, + addedAt: 1705637164, + updatedAt: 1705637165, + globalViewCount: 80, + audienceRatingImage: "rottentomatoes://image.rating.upright", + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + user: [ + { + id: 220, + }, + ], + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentresponsebody.md b/docs/models/gettopwatchedcontentresponsebody.md index 7c6b0f5d..37918f68 100644 --- a/docs/models/gettopwatchedcontentresponsebody.md +++ b/docs/models/gettopwatchedcontentresponsebody.md @@ -2,6 +2,88 @@ The metadata of the library item. +## Example Usage + +```typescript +import { GetTopWatchedContentResponseBody } from "@lukehagar/plexjs"; +import { RFCDate } from "@lukehagar/plexjs/types"; + +let value: GetTopWatchedContentResponseBody = { + mediaContainer: { + size: 1, + allowSync: true, + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + metadata: [ + { + ratingKey: "17", + key: "/library/metadata/17", + guid: "plex://movie/5d77683f6f4521001ea9dc53", + slug: "waterloo-road", + studio: "Universal Pictures", + type: "movie", + title: "Serenity", + librarySectionTitle: "Movies", + librarySectionID: 1, + librarySectionKey: "/library/sections/1", + contentRating: "PG-13", + summary: + "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.", + index: 1, + audienceRating: 9.1, + year: 2005, + tagline: "They aim to misbehave.", + thumb: "/library/metadata/17/thumb/1705637165", + art: "/library/metadata/17/art/1705637165", + duration: 141417, + originallyAvailableAt: new RFCDate("2005-09-29T00:00:00Z"), + leafCount: 222, + viewedLeafCount: 100, + childCount: 13, + addedAt: 1705637164, + updatedAt: 1705637165, + globalViewCount: 80, + audienceRatingImage: "rottentomatoes://image.rating.upright", + genre: [ + { + id: 184, + filter: "genre=184", + tag: "Thriller", + }, + ], + country: [ + { + id: 116, + filter: "country=116", + tag: "United States of America", + }, + ], + guids: [ + { + id: "tvdb://2337", + }, + ], + role: [ + { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", + }, + ], + user: [ + { + id: 220, + }, + ], + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/gettopwatchedcontentrole.md b/docs/models/gettopwatchedcontentrole.md index 590a0a88..13304236 100644 --- a/docs/models/gettopwatchedcontentrole.md +++ b/docs/models/gettopwatchedcontentrole.md @@ -1,5 +1,19 @@ # GetTopWatchedContentRole +## Example Usage + +```typescript +import { GetTopWatchedContentRole } from "@lukehagar/plexjs"; + +let value: GetTopWatchedContentRole = { + id: 220, + filter: "actor=220", + tag: "Dennis Keiffer", + tagKey: "5d77683554f42c001f8c4708", + role: "Bar Guy (uncredited)", + thumb: "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg", +}; +``` ## Fields diff --git a/docs/models/user.md b/docs/models/gettopwatchedcontentuser.md similarity index 64% rename from docs/models/user.md rename to docs/models/gettopwatchedcontentuser.md index 82eee8af..74f9aeed 100644 --- a/docs/models/user.md +++ b/docs/models/gettopwatchedcontentuser.md @@ -1,5 +1,14 @@ -# User +# GetTopWatchedContentUser +## Example Usage + +```typescript +import { GetTopWatchedContentUser } from "@lukehagar/plexjs"; + +let value: GetTopWatchedContentUser = { + id: 220, +}; +``` ## Fields diff --git a/docs/models/gettranscodesessionserrors.md b/docs/models/gettranscodesessionserrors.md index f26ecd1b..098cd7a7 100644 --- a/docs/models/gettranscodesessionserrors.md +++ b/docs/models/gettranscodesessionserrors.md @@ -1,5 +1,16 @@ # GetTranscodeSessionsErrors +## Example Usage + +```typescript +import { GetTranscodeSessionsErrors } from "@lukehagar/plexjs"; + +let value: GetTranscodeSessionsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/gettranscodesessionsmediacontainer.md b/docs/models/gettranscodesessionsmediacontainer.md index b12c2301..93a7f403 100644 --- a/docs/models/gettranscodesessionsmediacontainer.md +++ b/docs/models/gettranscodesessionsmediacontainer.md @@ -1,5 +1,42 @@ # GetTranscodeSessionsMediaContainer +## Example Usage + +```typescript +import { GetTranscodeSessionsMediaContainer } from "@lukehagar/plexjs"; + +let value: GetTranscodeSessionsMediaContainer = { + size: 1, + transcodeSession: [ + { + key: "vv3i2q2lax92qlzul1hbd4bx", + throttled: false, + complete: false, + progress: 1.7999999523162842, + size: -22, + speed: 25.100000381469727, + error: false, + duration: 1445695, + remaining: 53, + context: "streaming", + sourceVideoCodec: "h264", + sourceAudioCodec: "aac", + videoDecision: "transcode", + audioDecision: "transcode", + subtitleDecision: "burn", + protocol: "http", + container: "mkv", + videoCodec: "h264", + audioCodec: "opus", + audioChannels: 1, + transcodeHwRequested: true, + timeStamp: 1705895805.4919229, + maxOffsetAvailable: 29.53, + minOffsetAvailable: 3.003000020980835, + }, + ], +}; +``` ## Fields diff --git a/docs/models/gettranscodesessionsresponse.md b/docs/models/gettranscodesessionsresponse.md index 1948d7b4..d64d1956 100644 --- a/docs/models/gettranscodesessionsresponse.md +++ b/docs/models/gettranscodesessionsresponse.md @@ -1,5 +1,51 @@ # GetTranscodeSessionsResponse +## Example Usage + +```typescript +import { GetTranscodeSessionsResponse } from "@lukehagar/plexjs"; + +let value: GetTranscodeSessionsResponse = { + contentType: "", + statusCode: 110375, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 1, + transcodeSession: [ + { + key: "vv3i2q2lax92qlzul1hbd4bx", + throttled: false, + complete: false, + progress: 1.7999999523162842, + size: -22, + speed: 25.100000381469727, + error: false, + duration: 1445695, + remaining: 53, + context: "streaming", + sourceVideoCodec: "h264", + sourceAudioCodec: "aac", + videoDecision: "transcode", + audioDecision: "transcode", + subtitleDecision: "burn", + protocol: "http", + container: "mkv", + videoCodec: "h264", + audioCodec: "opus", + audioChannels: 1, + transcodeHwRequested: true, + timeStamp: 1705895805.4919229, + maxOffsetAvailable: 29.53, + minOffsetAvailable: 3.003000020980835, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/gettranscodesessionsresponsebody.md b/docs/models/gettranscodesessionsresponsebody.md index ccc4812f..4e49690c 100644 --- a/docs/models/gettranscodesessionsresponsebody.md +++ b/docs/models/gettranscodesessionsresponsebody.md @@ -2,6 +2,45 @@ The Transcode Sessions +## Example Usage + +```typescript +import { GetTranscodeSessionsResponseBody } from "@lukehagar/plexjs"; + +let value: GetTranscodeSessionsResponseBody = { + mediaContainer: { + size: 1, + transcodeSession: [ + { + key: "vv3i2q2lax92qlzul1hbd4bx", + throttled: false, + complete: false, + progress: 1.7999999523162842, + size: -22, + speed: 25.100000381469727, + error: false, + duration: 1445695, + remaining: 53, + context: "streaming", + sourceVideoCodec: "h264", + sourceAudioCodec: "aac", + videoDecision: "transcode", + audioDecision: "transcode", + subtitleDecision: "burn", + protocol: "http", + container: "mkv", + videoCodec: "h264", + audioCodec: "opus", + audioChannels: 1, + transcodeHwRequested: true, + timeStamp: 1705895805.4919229, + maxOffsetAvailable: 29.53, + minOffsetAvailable: 3.003000020980835, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/gettranscodesessionssessionsresponsebody.md b/docs/models/gettranscodesessionssessionsresponsebody.md index a9dff050..e31e4357 100644 --- a/docs/models/gettranscodesessionssessionsresponsebody.md +++ b/docs/models/gettranscodesessionssessionsresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetTranscodeSessionsSessionsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/gettransienttokenerrors.md b/docs/models/gettransienttokenerrors.md index c5be21cb..b0d4932e 100644 --- a/docs/models/gettransienttokenerrors.md +++ b/docs/models/gettransienttokenerrors.md @@ -1,5 +1,16 @@ # GetTransientTokenErrors +## Example Usage + +```typescript +import { GetTransientTokenErrors } from "@lukehagar/plexjs"; + +let value: GetTransientTokenErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/gettransienttokenqueryparamtype.md b/docs/models/gettransienttokenqueryparamtype.md index ed8d4a47..216263bf 100644 --- a/docs/models/gettransienttokenqueryparamtype.md +++ b/docs/models/gettransienttokenqueryparamtype.md @@ -2,6 +2,13 @@ `delegation` - This is the only supported `type` parameter. +## Example Usage + +```typescript +import { GetTransientTokenQueryParamType } from "@lukehagar/plexjs"; + +let value: GetTransientTokenQueryParamType = GetTransientTokenQueryParamType.Delegation; +``` ## Values diff --git a/docs/models/gettransienttokenrequest.md b/docs/models/gettransienttokenrequest.md index a2e00753..b3dafcfe 100644 --- a/docs/models/gettransienttokenrequest.md +++ b/docs/models/gettransienttokenrequest.md @@ -1,5 +1,15 @@ # GetTransientTokenRequest +## Example Usage + +```typescript +import { GetTransientTokenQueryParamType, GetTransientTokenRequest, Scope } from "@lukehagar/plexjs"; + +let value: GetTransientTokenRequest = { + type: GetTransientTokenQueryParamType.Delegation, + scope: Scope.All, +}; +``` ## Fields diff --git a/docs/models/gettransienttokenresponse.md b/docs/models/gettransienttokenresponse.md index 2c6fde61..c8cbb92b 100644 --- a/docs/models/gettransienttokenresponse.md +++ b/docs/models/gettransienttokenresponse.md @@ -1,5 +1,18 @@ # GetTransientTokenResponse +## Example Usage + +```typescript +import { GetTransientTokenResponse } from "@lukehagar/plexjs"; + +let value: GetTransientTokenResponse = { + contentType: "", + statusCode: 253291, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/gettransienttokenresponsebody.md b/docs/models/gettransienttokenresponsebody.md index e20e73b4..0028f7ae 100644 --- a/docs/models/gettransienttokenresponsebody.md +++ b/docs/models/gettransienttokenresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetTransientTokenResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getupdatestatuserrors.md b/docs/models/getupdatestatuserrors.md index 97105c1b..7aab8687 100644 --- a/docs/models/getupdatestatuserrors.md +++ b/docs/models/getupdatestatuserrors.md @@ -1,5 +1,16 @@ # GetUpdateStatusErrors +## Example Usage + +```typescript +import { GetUpdateStatusErrors } from "@lukehagar/plexjs"; + +let value: GetUpdateStatusErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getupdatestatusmediacontainer.md b/docs/models/getupdatestatusmediacontainer.md index 38333b18..1b041927 100644 --- a/docs/models/getupdatestatusmediacontainer.md +++ b/docs/models/getupdatestatusmediacontainer.md @@ -1,5 +1,43 @@ # GetUpdateStatusMediaContainer +## Example Usage + +```typescript +import { GetUpdateStatusMediaContainer } from "@lukehagar/plexjs"; + +let value: GetUpdateStatusMediaContainer = { + size: 1, + canInstall: false, + checkedAt: 1705801232, + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + status: 0, + release: [ + { + key: "https://plex.tv/updater/releases/5136", + version: "1.40.0.7775-456fbaf97", + added: "(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish. + (Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793) + (Music) Store track genres and add filtering options (#14653) + (Music) Support ID3v2.4 null-separated tags for genres and release type (#14653) + (View History) No longer create a view history entry for items marked as played (#10888) + (Web) Updated to 4.118.0", + fixed: "(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483) + (Agents) It is possible that agents are not initialised during startup on rare occasions (#14654) + (Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667) + (Collection) Server could become unresponsive when collection membership changes (#14612) + (DVR) Previously watched recordings could be deleted without being watched again (#13779) + (Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501) + (Library) The Content Rating not equal to None filter does not work (#14620) + (Search) Album search results could contain all the album's tracks too (#14486) + (Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674) + (Transcoder) HW encoding would fail on devices with no rate control (#14222) + (Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)", + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + state: "notify", + }, + ], +}; +``` ## Fields diff --git a/docs/models/getupdatestatusresponse.md b/docs/models/getupdatestatusresponse.md index 5f8751a1..254b6b61 100644 --- a/docs/models/getupdatestatusresponse.md +++ b/docs/models/getupdatestatusresponse.md @@ -1,5 +1,50 @@ # GetUpdateStatusResponse +## Example Usage + +```typescript +import { GetUpdateStatusResponse } from "@lukehagar/plexjs"; + +let value: GetUpdateStatusResponse = { + contentType: "", + statusCode: 656330, + rawResponse: new Response('{"message": "hello world"}', {headers: {"Content-Type": "application/json"}}), + object: { + mediaContainer: { + size: 1, + canInstall: false, + checkedAt: 1705801232, + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + status: 0, + release: [ + { + key: "https://plex.tv/updater/releases/5136", + version: "1.40.0.7775-456fbaf97", + added: "(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish. + (Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793) + (Music) Store track genres and add filtering options (#14653) + (Music) Support ID3v2.4 null-separated tags for genres and release type (#14653) + (View History) No longer create a view history entry for items marked as played (#10888) + (Web) Updated to 4.118.0", + fixed: "(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483) + (Agents) It is possible that agents are not initialised during startup on rare occasions (#14654) + (Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667) + (Collection) Server could become unresponsive when collection membership changes (#14612) + (DVR) Previously watched recordings could be deleted without being watched again (#13779) + (Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501) + (Library) The Content Rating not equal to None filter does not work (#14620) + (Search) Album search results could contain all the album's tracks too (#14486) + (Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674) + (Transcoder) HW encoding would fail on devices with no rate control (#14222) + (Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)", + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + state: "notify", + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/getupdatestatusresponsebody.md b/docs/models/getupdatestatusresponsebody.md index 641f9065..533691c7 100644 --- a/docs/models/getupdatestatusresponsebody.md +++ b/docs/models/getupdatestatusresponsebody.md @@ -2,6 +2,46 @@ The Server Updates +## Example Usage + +```typescript +import { GetUpdateStatusResponseBody } from "@lukehagar/plexjs"; + +let value: GetUpdateStatusResponseBody = { + mediaContainer: { + size: 1, + canInstall: false, + checkedAt: 1705801232, + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + status: 0, + release: [ + { + key: "https://plex.tv/updater/releases/5136", + version: "1.40.0.7775-456fbaf97", + added: "(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish. + (Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793) + (Music) Store track genres and add filtering options (#14653) + (Music) Support ID3v2.4 null-separated tags for genres and release type (#14653) + (View History) No longer create a view history entry for items marked as played (#10888) + (Web) Updated to 4.118.0", + fixed: "(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483) + (Agents) It is possible that agents are not initialised during startup on rare occasions (#14654) + (Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667) + (Collection) Server could become unresponsive when collection membership changes (#14612) + (DVR) Previously watched recordings could be deleted without being watched again (#13779) + (Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501) + (Library) The Content Rating not equal to None filter does not work (#14620) + (Search) Album search results could contain all the album's tracks too (#14486) + (Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674) + (Transcoder) HW encoding would fail on devices with no rate control (#14222) + (Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)", + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + state: "notify", + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/getupdatestatusupdaterresponsebody.md b/docs/models/getupdatestatusupdaterresponsebody.md index b56ade12..0c7e2694 100644 --- a/docs/models/getupdatestatusupdaterresponsebody.md +++ b/docs/models/getupdatestatusupdaterresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetUpdateStatusUpdaterResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/getuserdetailserrors.md b/docs/models/getuserdetailserrors.md new file mode 100644 index 00000000..cbdbe447 --- /dev/null +++ b/docs/models/getuserdetailserrors.md @@ -0,0 +1,21 @@ +# GetUserDetailsErrors + +## Example Usage + +```typescript +import { GetUserDetailsErrors } from "@lukehagar/plexjs"; + +let value: GetUserDetailsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *number* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/getuserdetailsfeatures.md b/docs/models/getuserdetailsfeatures.md new file mode 100644 index 00000000..b934db1f --- /dev/null +++ b/docs/models/getuserdetailsfeatures.md @@ -0,0 +1,73 @@ +# GetUserDetailsFeatures + +## Example Usage + +```typescript +import { GetUserDetailsFeatures } from "@lukehagar/plexjs"; + +let value: GetUserDetailsFeatures = GetUserDetailsFeatures.PhotosFavorites; +``` + +## Values + +| Name | Value | +| --------------------------------------- | --------------------------------------- | +| `AndroidDolbyVision` | Android - Dolby Vision | +| `AndroidPiP` | Android - PiP | +| `CUSunset` | CU Sunset | +| `HRKEnableEUR` | HRK_enable_EUR | +| `TREBLEShowFeatures` | TREBLE-show-features | +| `AdCountdownTimer` | ad-countdown-timer | +| `AdaptiveBitrate` | adaptive_bitrate | +| `AmazonLoopDebug` | amazon-loop-debug | +| `AvodAdAnalysis` | avod-ad-analysis | +| `AvodNewMedia` | avod-new-media | +| `BlacklistGetSignin` | blacklist_get_signin | +| `ClientRadioStations` | client-radio-stations | +| `CloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `Collections` | collections | +| `CommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `CommunityAccessPlexTv` | community_access_plex_tv | +| `CompanionsSonos` | companions_sonos | +| `CustomHomeRemoval` | custom-home-removal | +| `DisableHomeUserFriendships` | disable_home_user_friendships | +| `DisableSharingFriendships` | disable_sharing_friendships | +| `DrmSupport` | drm_support | +| `ExcludeRestrictions` | exclude restrictions | +| `FederatedAuth` | federated-auth | +| `FriendRequestPushNotifications` | friend_request_push_notifications | +| `GuidedUpgrade` | guided-upgrade | +| `Home` | home | +| `IncreasePasswordComplexity` | increase-password-complexity | +| `Ios14PrivacyBanner` | ios14-privacy-banner | +| `IterableNotificationTokens` | iterable-notification-tokens | +| `KeepPaymentMethod` | keep-payment-method | +| `KevinBacon` | kevin-bacon | +| `KoreaConsent` | korea-consent | +| `LeIsrgRootX1` | le_isrg_root_x1 | +| `LetsEncrypt` | lets_encrypt | +| `LightningDvrPivot` | lightning-dvr-pivot | +| `LiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `Livetv` | livetv | +| `MetadataSearch` | metadata_search | +| `NewPlexPassPrices` | new_plex_pass_prices | +| `NewsProviderSunsetModal` | news-provider-sunset-modal | +| `PhotosFavorites` | photos-favorites | +| `PhotosMetadataEdition` | photos-metadata-edition | +| `PmsHealth` | pms_health | +| `Radio` | radio | +| `RateLimitClientToken` | rate-limit-client-token | +| `ScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `SharedServerNotification` | shared_server_notification | +| `SharedSourceNotification` | shared_source_notification | +| `SigninWithApple` | signin_with_apple | +| `SpringServeAdProvider` | spring_serve_ad_provider | +| `TranscoderCache` | transcoder_cache | +| `TunerSharing` | tuner-sharing | +| `TwoFactorAuthentication` | two-factor-authentication | +| `Unsupportedtuners` | unsupportedtuners | +| `Upgrade3ds2` | upgrade-3ds2 | +| `VodSchema` | vod-schema | +| `VodCloudflare` | vod_cloudflare | +| `WatchTogetherInvite` | watch-together-invite | +| `WebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/getuserdetailsplexresponsestatus.md b/docs/models/getuserdetailsplexresponsestatus.md new file mode 100644 index 00000000..ca0b3fdd --- /dev/null +++ b/docs/models/getuserdetailsplexresponsestatus.md @@ -0,0 +1,18 @@ +# GetUserDetailsPlexResponseStatus + +String representation of subscriptionActive + +## Example Usage + +```typescript +import { GetUserDetailsPlexResponseStatus } from "@lukehagar/plexjs"; + +let value: GetUserDetailsPlexResponseStatus = GetUserDetailsPlexResponseStatus.Inactive; +``` + +## Values + +| Name | Value | +| ---------- | ---------- | +| `Inactive` | Inactive | +| `Active` | Active | \ No newline at end of file diff --git a/docs/models/getuserdetailsplexstatus.md b/docs/models/getuserdetailsplexstatus.md new file mode 100644 index 00000000..34b9c35a --- /dev/null +++ b/docs/models/getuserdetailsplexstatus.md @@ -0,0 +1,18 @@ +# GetUserDetailsPlexStatus + +String representation of subscriptionActive + +## Example Usage + +```typescript +import { GetUserDetailsPlexStatus } from "@lukehagar/plexjs"; + +let value: GetUserDetailsPlexStatus = GetUserDetailsPlexStatus.Inactive; +``` + +## Values + +| Name | Value | +| ---------- | ---------- | +| `Inactive` | Inactive | +| `Active` | Active | \ No newline at end of file diff --git a/docs/models/getuserdetailsresponse.md b/docs/models/getuserdetailsresponse.md new file mode 100644 index 00000000..8c7b25f5 --- /dev/null +++ b/docs/models/getuserdetailsresponse.md @@ -0,0 +1,109 @@ +# GetUserDetailsResponse + +## Example Usage + +```typescript +import { + Features, + GetUserDetailsFeatures, + GetUserDetailsPlexResponseStatus, + GetUserDetailsPlexStatus, + GetUserDetailsResponse, + GetUserDetailsStatus, + MailingListStatus, +} from "@lukehagar/plexjs"; + +let value: GetUserDetailsResponse = { + contentType: "", + statusCode: 118274, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + userPlexAccount: { + adsConsent: true, + adsConsentReminderAt: new Date("2019-08-24T14:15:22Z"), + adsConsentSetAt: new Date("2019-08-24T14:15:22Z"), + anonymous: false, + authToken: "CxoUzBTSV5hsxjTpFKaf", + backupCodesCreated: false, + confirmed: false, + country: "US", + email: "username@email.com", + emailOnlyAuth: false, + experimentalFeatures: false, + friendlyName: "friendlyUsername", + entitlements: ["[]"], + guest: false, + hasPassword: true, + home: false, + homeAdmin: false, + homeSize: 1, + id: 13692262, + joinedAt: 1721154902, + locale: null, + mailingListActive: false, + mailingListStatus: MailingListStatus.Subscribed, + maxHomeSize: 15, + pin: "string", + profile: [ + { + autoSelectAudio: true, + defaultAudioLanguage: "ja", + defaultSubtitleLanguage: "en", + autoSelectSubtitle: 1, + defaultSubtitleAccessibility: 1, + defaultSubtitleForced: 0, + watchedIndicator: 1, + mediaReviewsVisibility: 0, + }, + ], + protected: false, + rememberExpiresAt: 1722364046, + restricted: false, + roles: ["string"], + scrobbleTypes: "", + services: [ + { + identifier: "metadata-dev", + endpoint: "https://epg.provider.plex.tv", + token: "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", + secret: "string", + status: GetUserDetailsStatus.Online, + }, + ], + subscription: { + features: [Features.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: GetUserDetailsPlexStatus.Inactive, + paymentService: "string", + plan: "string", + }, + subscriptionDescription: "string", + subscriptions: [ + { + features: [GetUserDetailsFeatures.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: GetUserDetailsPlexResponseStatus.Inactive, + paymentService: "string", + plan: "string", + }, + ], + thumb: "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", + title: "UsernameTitle", + twoFactorEnabled: false, + username: "Username", + uuid: "dae343c1f45beb4f", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `userPlexAccount` | [models.GetUserDetailsUserPlexAccount](../models/getuserdetailsuserplexaccount.md) | :heavy_minus_sign: | Logged in user details | {
"adsConsent": true,
"adsConsentReminderAt": "2019-08-24T14:15:22Z",
"adsConsentSetAt": "2019-08-24T14:15:22Z",
"anonymous": false,
"authToken": "CxoUzBTSV5hsxjTpFKaf",
"backupCodesCreated": false,
"confirmed": false,
"country": "US",
"email": "username@email.com",
"emailOnlyAuth": false,
"experimentalFeatures": false,
"friendlyName": "friendlyUsername",
"entitlements": [],
"guest": false,
"hasPassword": true,
"home": false,
"homeAdmin": false,
"homeSize": 1,
"id": 13692262,
"joinedAt": 1721154902,
"locale": null,
"mailingListActive": false,
"mailingListStatus": "subscribed",
"maxHomeSize": 15,
"pastSubscriptions": [
{
"id": "string",
"mode": "string",
"renewsAt": "string",
"endsAt": "1556281940",
"canceled": "0",
"gracePeriod": "0",
"onHold": "0",
"canReactivate": "0",
"canUpgrade": "0",
"canDowngrade": "0",
"canConvert": "0",
"type": "plexpass",
"transfer": "string",
"state": "ended",
"billing": [
{
"internalPaymentMethod": "string",
"paymentMethodId": "string"
}
]
}
],
"pin": "string",
"profile": [
{
"autoSelectAudio": true,
"defaultAudioLanguage": "ja",
"defaultSubtitleLanguage": "en",
"autoSelectSubtitle": 1,
"defaultSubtitleAccessibility": 1,
"defaultSubtitleForced": 0,
"watchedIndicator": 1,
"mediaReviewsVisibility": 0
}
],
"protected": false,
"rememberExpiresAt": 1722364046,
"restricted": false,
"roles": [
"string"
],
"scrobbleTypes": "",
"services": [
{
"identifier": "metadata-dev",
"endpoint": "https://epg.provider.plex.tv",
"token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
"secret": "string",
"status": "online"
}
],
"subscription": {
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
},
"subscriptionDescription": "string",
"subscriptions": [
{
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
}
],
"thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
"title": "UsernameTitle",
"trials": [
{}
],
"twoFactorEnabled": false,
"username": "Username",
"uuid": "dae343c1f45beb4f"
} | \ No newline at end of file diff --git a/docs/models/getuserdetailsresponsebody.md b/docs/models/getuserdetailsresponsebody.md new file mode 100644 index 00000000..2b2a7922 --- /dev/null +++ b/docs/models/getuserdetailsresponsebody.md @@ -0,0 +1,18 @@ +# GetUserDetailsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + +## Example Usage + +```typescript +import { GetUserDetailsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `errors` | [models.GetUserDetailsErrors](../models/getuserdetailserrors.md)[] | :heavy_minus_sign: | N/A | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/getuserdetailsstatus.md b/docs/models/getuserdetailsstatus.md new file mode 100644 index 00000000..00e83da0 --- /dev/null +++ b/docs/models/getuserdetailsstatus.md @@ -0,0 +1,16 @@ +# GetUserDetailsStatus + +## Example Usage + +```typescript +import { GetUserDetailsStatus } from "@lukehagar/plexjs"; + +let value: GetUserDetailsStatus = GetUserDetailsStatus.Online; +``` + +## Values + +| Name | Value | +| --------- | --------- | +| `Online` | online | +| `Offline` | offline | \ No newline at end of file diff --git a/docs/models/getuserdetailssubscription.md b/docs/models/getuserdetailssubscription.md new file mode 100644 index 00000000..3fe058a2 --- /dev/null +++ b/docs/models/getuserdetailssubscription.md @@ -0,0 +1,24 @@ +# GetUserDetailsSubscription + +## Example Usage + +```typescript +import { GetUserDetailsPlexResponseStatus, GetUserDetailsSubscription } from "@lukehagar/plexjs"; + +let value: GetUserDetailsSubscription = { + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: GetUserDetailsPlexResponseStatus.Inactive, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `features` | [models.GetUserDetailsFeatures](../models/getuserdetailsfeatures.md)[] | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `active` | *boolean* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `subscribedAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `status` | [models.GetUserDetailsPlexResponseStatus](../models/getuserdetailsplexresponsestatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `paymentService` | *string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `plan` | *string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/getuserdetailsuserplexaccount.md b/docs/models/getuserdetailsuserplexaccount.md new file mode 100644 index 00000000..cb589331 --- /dev/null +++ b/docs/models/getuserdetailsuserplexaccount.md @@ -0,0 +1,140 @@ +# GetUserDetailsUserPlexAccount + +Logged in user details + +## Example Usage + +```typescript +import { + Features, + GetUserDetailsFeatures, + GetUserDetailsPlexResponseStatus, + GetUserDetailsPlexStatus, + GetUserDetailsStatus, + GetUserDetailsUserPlexAccount, + MailingListStatus, +} from "@lukehagar/plexjs"; + +let value: GetUserDetailsUserPlexAccount = { + adsConsent: true, + adsConsentReminderAt: new Date("2019-08-24T14:15:22Z"), + adsConsentSetAt: new Date("2019-08-24T14:15:22Z"), + anonymous: false, + authToken: "CxoUzBTSV5hsxjTpFKaf", + backupCodesCreated: false, + confirmed: false, + country: "US", + email: "username@email.com", + emailOnlyAuth: false, + experimentalFeatures: false, + friendlyName: "friendlyUsername", + entitlements: ["[]"], + guest: false, + hasPassword: true, + home: false, + homeAdmin: false, + homeSize: 1, + id: 13692262, + joinedAt: 1721154902, + locale: null, + mailingListActive: false, + mailingListStatus: MailingListStatus.Subscribed, + maxHomeSize: 15, + pin: "string", + profile: [ + { + autoSelectAudio: true, + defaultAudioLanguage: "ja", + defaultSubtitleLanguage: "en", + autoSelectSubtitle: 1, + defaultSubtitleAccessibility: 1, + defaultSubtitleForced: 0, + watchedIndicator: 1, + mediaReviewsVisibility: 0, + }, + ], + protected: false, + rememberExpiresAt: 1722364046, + restricted: false, + roles: ["string"], + scrobbleTypes: "", + services: [ + { + identifier: "metadata-dev", + endpoint: "https://epg.provider.plex.tv", + token: "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", + secret: "string", + status: GetUserDetailsStatus.Online, + }, + ], + subscription: { + features: [Features.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: GetUserDetailsPlexStatus.Inactive, + paymentService: "string", + plan: "string", + }, + subscriptionDescription: "string", + subscriptions: [ + { + features: [GetUserDetailsFeatures.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: GetUserDetailsPlexResponseStatus.Inactive, + paymentService: "string", + plan: "string", + }, + ], + thumb: "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", + title: "UsernameTitle", + twoFactorEnabled: false, + username: "Username", + uuid: "dae343c1f45beb4f", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `adsConsent` | *boolean* | :heavy_check_mark: | Unknown | | +| `adsConsentReminderAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Unknown | | +| `adsConsentSetAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Unknown | | +| `anonymous` | *boolean* | :heavy_minus_sign: | Unknown | | +| `authToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf | +| `backupCodesCreated` | *boolean* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | | +| `confirmed` | *boolean* | :heavy_minus_sign: | If the account has been confirmed | | +| `country` | *string* | :heavy_check_mark: | The account country | US | +| `email` | *string* | :heavy_check_mark: | The account email address | username@email.com | +| `emailOnlyAuth` | *boolean* | :heavy_minus_sign: | If login with email only is enabled | | +| `experimentalFeatures` | *boolean* | :heavy_minus_sign: | If experimental features are enabled | | +| `friendlyName` | *string* | :heavy_check_mark: | Your account full name | friendlyUsername | +| `entitlements` | *string*[] | :heavy_check_mark: | List of devices your allowed to use with this account | | +| `guest` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home guest user | | +| `hasPassword` | *boolean* | :heavy_minus_sign: | If the account has a password | | +| `home` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home user | | +| `homeAdmin` | *boolean* | :heavy_minus_sign: | If the account is the Plex Home admin | | +| `homeSize` | *number* | :heavy_check_mark: | The number of accounts in the Plex Home | 1 | +| `id` | *number* | :heavy_check_mark: | The Plex account ID | 13692262 | +| `joinedAt` | *number* | :heavy_check_mark: | Unix epoch datetime the account joined Plex | 1721154902 | +| `locale` | *string* | :heavy_check_mark: | The account locale | | +| `mailingListActive` | *boolean* | :heavy_minus_sign: | If you are subscribed to the Plex newsletter | | +| `mailingListStatus` | [models.MailingListStatus](../models/mailingliststatus.md) | :heavy_check_mark: | Your current mailing list status | | +| `maxHomeSize` | *number* | :heavy_check_mark: | The maximum number of accounts allowed in the Plex Home | 15 | +| ~~`pin`~~ | *string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

[Might be removed] The hashed Plex Home PIN | | +| `profile` | [models.UserProfile](../models/userprofile.md)[] | :heavy_check_mark: | N/A | | +| `protected` | *boolean* | :heavy_minus_sign: | If the account has a Plex Home PIN enabled | | +| `rememberExpiresAt` | *number* | :heavy_check_mark: | Unix epoch datetime the authtoken expires | 1722364046 | +| `restricted` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home managed user | | +| `roles` | *string*[] | :heavy_minus_sign: | [Might be removed] List of account roles. Plexpass membership listed here | | +| `scrobbleTypes` | *string* | :heavy_check_mark: | Unknown | | +| `services` | [models.Services](../models/services.md)[] | :heavy_check_mark: | N/A | | +| `subscription` | [models.Subscription](../models/subscription.md) | :heavy_check_mark: | If the account’s Plex Pass subscription is active | | +| `subscriptionDescription` | *string* | :heavy_check_mark: | Description of the Plex Pass subscription | | +| `subscriptions` | [models.GetUserDetailsSubscription](../models/getuserdetailssubscription.md)[] | :heavy_check_mark: | N/A | | +| `thumb` | *string* | :heavy_check_mark: | URL of the account thumbnail | https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101 | +| `title` | *string* | :heavy_check_mark: | The title of the account (username or friendly name) | UsernameTitle | +| `twoFactorEnabled` | *boolean* | :heavy_minus_sign: | If two-factor authentication is enabled | | +| `username` | *string* | :heavy_check_mark: | The account username | Username | +| `uuid` | *string* | :heavy_check_mark: | The account UUID | dae343c1f45beb4f | \ No newline at end of file diff --git a/docs/models/getuserfriendserrors.md b/docs/models/getuserfriendserrors.md new file mode 100644 index 00000000..d80c009d --- /dev/null +++ b/docs/models/getuserfriendserrors.md @@ -0,0 +1,21 @@ +# GetUserFriendsErrors + +## Example Usage + +```typescript +import { GetUserFriendsErrors } from "@lukehagar/plexjs"; + +let value: GetUserFriendsErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *number* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/getuserfriendsresponse.md b/docs/models/getuserfriendsresponse.md new file mode 100644 index 00000000..44f4b76e --- /dev/null +++ b/docs/models/getuserfriendsresponse.md @@ -0,0 +1,40 @@ +# GetUserFriendsResponse + +## Example Usage + +```typescript +import { GetUserFriendsResponse, Status } from "@lukehagar/plexjs"; + +let value: GetUserFriendsResponse = { + contentType: "", + statusCode: 87129, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + friends: [ + { + email: "username@email.com", + friendlyName: "exampleUser", + home: true, + id: 0, + restricted: false, + sharedServers: [{}], + sharedSources: [{}], + status: Status.Accepted, + thumb: "https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578", + title: "username123", + username: "username123", + uuid: "7d1916e0d8f6e76b", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `friends` | [models.Friend](../models/friend.md)[] | :heavy_minus_sign: | Friends Data | \ No newline at end of file diff --git a/docs/models/getuserfriendsresponsebody.md b/docs/models/getuserfriendsresponsebody.md new file mode 100644 index 00000000..6b73225c --- /dev/null +++ b/docs/models/getuserfriendsresponsebody.md @@ -0,0 +1,18 @@ +# GetUserFriendsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + +## Example Usage + +```typescript +import { GetUserFriendsResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `errors` | [models.GetUserFriendsErrors](../models/getuserfriendserrors.md)[] | :heavy_minus_sign: | N/A | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/getwatchlisterrors.md b/docs/models/getwatchlisterrors.md index 68f15f16..9b76e781 100644 --- a/docs/models/getwatchlisterrors.md +++ b/docs/models/getwatchlisterrors.md @@ -1,5 +1,16 @@ # GetWatchlistErrors +## Example Usage + +```typescript +import { GetWatchlistErrors } from "@lukehagar/plexjs"; + +let value: GetWatchlistErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/getwatchlistrequest.md b/docs/models/getwatchlistrequest.md index 6c282947..75eac0ab 100644 --- a/docs/models/getwatchlistrequest.md +++ b/docs/models/getwatchlistrequest.md @@ -1,5 +1,15 @@ # GetWatchlistRequest +## Example Usage + +```typescript +import { GetWatchlistRequest, PathParamFilter } from "@lukehagar/plexjs"; + +let value: GetWatchlistRequest = { + filter: PathParamFilter.All, + xPlexToken: "", +}; +``` ## Fields diff --git a/docs/models/getwatchlistresponse.md b/docs/models/getwatchlistresponse.md index d2e1a0f3..5f1fc243 100644 --- a/docs/models/getwatchlistresponse.md +++ b/docs/models/getwatchlistresponse.md @@ -1,5 +1,18 @@ # GetWatchlistResponse +## Example Usage + +```typescript +import { GetWatchlistResponse } from "@lukehagar/plexjs"; + +let value: GetWatchlistResponse = { + contentType: "", + statusCode: 971945, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/getwatchlistresponsebody.md b/docs/models/getwatchlistresponsebody.md index bab58336..c3e4a8a4 100644 --- a/docs/models/getwatchlistresponsebody.md +++ b/docs/models/getwatchlistresponsebody.md @@ -2,6 +2,13 @@ Watchlist Data +## Example Usage + +```typescript +import { GetWatchlistResponseBody } from "@lukehagar/plexjs"; + +let value: GetWatchlistResponseBody = {}; +``` ## Fields diff --git a/docs/models/getwatchlistwatchlistresponsebody.md b/docs/models/getwatchlistwatchlistresponsebody.md index f2bb3b17..3250a844 100644 --- a/docs/models/getwatchlistwatchlistresponsebody.md +++ b/docs/models/getwatchlistwatchlistresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { GetWatchlistWatchlistResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/guids.md b/docs/models/guids.md index 2503d9b8..6c3305ac 100644 --- a/docs/models/guids.md +++ b/docs/models/guids.md @@ -1,5 +1,14 @@ # Guids +## Example Usage + +```typescript +import { Guids } from "@lukehagar/plexjs"; + +let value: Guids = { + id: "tvdb://2337", +}; +``` ## Fields diff --git a/docs/models/hub.md b/docs/models/hub.md index bef70266..34952ded 100644 --- a/docs/models/hub.md +++ b/docs/models/hub.md @@ -1,5 +1,44 @@ # Hub +## Example Usage + +```typescript +import { Hub } from "@lukehagar/plexjs"; + +let value: Hub = { + hubKey: "/library/metadata/50768,65523,58188,57341,57302,57070", + key: "/playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio", + title: "Recent Playlists", + type: "playlist", + hubIdentifier: "home.playlists", + context: "hub.home.playlists", + size: 6, + more: true, + style: "shelf", + promoted: true, + metadata: [ + { + ratingKey: "57070", + key: "/playlists/57070/items", + guid: "com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c", + type: "playlist", + title: "November Movie Day", + titleSort: "Tracks", + summary: "", + smart: false, + playlistType: "video", + composite: "/playlists/57070/composite/1668787730", + icon: "playlist://image.smart", + viewCount: 2, + lastViewedAt: 1668787732, + duration: 16873000, + leafCount: 3, + addedAt: 1668779618, + updatedAt: 1668787730, + }, + ], +}; +``` ## Fields diff --git a/docs/models/image.md b/docs/models/image.md index 1aced002..b822af26 100644 --- a/docs/models/image.md +++ b/docs/models/image.md @@ -1,5 +1,12 @@ # Image +## Example Usage + +```typescript +import { Image } from "@lukehagar/plexjs"; + +let value: Image = {}; +``` ## Fields diff --git a/docs/models/includecollections.md b/docs/models/includecollections.md index ba1fb4b9..da89f4e6 100644 --- a/docs/models/includecollections.md +++ b/docs/models/includecollections.md @@ -3,6 +3,13 @@ include collections in the results +## Example Usage + +```typescript +import { IncludeCollections } from "@lukehagar/plexjs"; + +let value: IncludeCollections = IncludeCollections.Zero; +``` ## Values diff --git a/docs/models/includedetails.md b/docs/models/includedetails.md index 7085055f..0d96de11 100644 --- a/docs/models/includedetails.md +++ b/docs/models/includedetails.md @@ -4,6 +4,13 @@ Whether or not to include details for a section (types, filters, and sorts). Only exists for backwards compatibility, media providers other than the server libraries have it on always. +## Example Usage + +```typescript +import { IncludeDetails } from "@lukehagar/plexjs"; + +let value: IncludeDetails = IncludeDetails.Zero; +``` ## Values diff --git a/docs/models/includeexternalmedia.md b/docs/models/includeexternalmedia.md index 90c652ee..cce79799 100644 --- a/docs/models/includeexternalmedia.md +++ b/docs/models/includeexternalmedia.md @@ -3,6 +3,13 @@ include external media in the results +## Example Usage + +```typescript +import { IncludeExternalMedia } from "@lukehagar/plexjs"; + +let value: IncludeExternalMedia = IncludeExternalMedia.Zero; +``` ## Values diff --git a/docs/models/includehttps.md b/docs/models/includehttps.md new file mode 100644 index 00000000..fac062e6 --- /dev/null +++ b/docs/models/includehttps.md @@ -0,0 +1,18 @@ +# IncludeHttps + +Include Https entries in the results + +## Example Usage + +```typescript +import { IncludeHttps } from "@lukehagar/plexjs"; + +let value: IncludeHttps = IncludeHttps.Zero; +``` + +## Values + +| Name | Value | +| ------ | ------ | +| `Zero` | 0 | +| `One` | 1 | \ No newline at end of file diff --git a/docs/models/includeipv6.md b/docs/models/includeipv6.md new file mode 100644 index 00000000..9e57b61a --- /dev/null +++ b/docs/models/includeipv6.md @@ -0,0 +1,18 @@ +# IncludeIPv6 + +Include IPv6 entries in the results + +## Example Usage + +```typescript +import { IncludeIPv6 } from "@lukehagar/plexjs"; + +let value: IncludeIPv6 = IncludeIPv6.One; +``` + +## Values + +| Name | Value | +| ------ | ------ | +| `Zero` | 0 | +| `One` | 1 | \ No newline at end of file diff --git a/docs/models/includerelay.md b/docs/models/includerelay.md new file mode 100644 index 00000000..d65e1a46 --- /dev/null +++ b/docs/models/includerelay.md @@ -0,0 +1,18 @@ +# IncludeRelay + +Include Relay addresses in the results + +## Example Usage + +```typescript +import { IncludeRelay } from "@lukehagar/plexjs"; + +let value: IncludeRelay = IncludeRelay.One; +``` + +## Values + +| Name | Value | +| ------ | ------ | +| `Zero` | 0 | +| `One` | 1 | \ No newline at end of file diff --git a/docs/models/internalpaymentmethod.md b/docs/models/internalpaymentmethod.md new file mode 100644 index 00000000..4212eedc --- /dev/null +++ b/docs/models/internalpaymentmethod.md @@ -0,0 +1,14 @@ +# InternalPaymentMethod + +## Example Usage + +```typescript +import { InternalPaymentMethod } from "@lukehagar/plexjs"; + +let value: InternalPaymentMethod = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/level.md b/docs/models/level.md index 29b65371..b2f4b39c 100644 --- a/docs/models/level.md +++ b/docs/models/level.md @@ -8,6 +8,13 @@ An integer log level to write to the PMS log with. 4: Verbose +## Example Usage + +```typescript +import { Level } from "@lukehagar/plexjs"; + +let value: Level = Level.Three; +``` ## Values diff --git a/docs/models/librarysectionid.md b/docs/models/librarysectionid.md index 88049fa3..f41d01dd 100644 --- a/docs/models/librarysectionid.md +++ b/docs/models/librarysectionid.md @@ -1,5 +1,12 @@ # LibrarySectionID +## Example Usage + +```typescript +import { LibrarySectionID } from "@lukehagar/plexjs"; + +let value: LibrarySectionID = ""; +``` ## Supported Types diff --git a/docs/models/libtype.md b/docs/models/libtype.md index 9bc1edd9..f3fa0f1c 100644 --- a/docs/models/libtype.md +++ b/docs/models/libtype.md @@ -3,6 +3,13 @@ The type of library to filter. Can be "movie" or "show", or all if not present. +## Example Usage + +```typescript +import { Libtype } from "@lukehagar/plexjs"; + +let value: Libtype = Libtype.Show; +``` ## Values diff --git a/docs/models/location.md b/docs/models/location.md index cec36bc3..e2c1709a 100644 --- a/docs/models/location.md +++ b/docs/models/location.md @@ -1,17 +1,19 @@ # Location +## Example Usage + +```typescript +import { Location } from "@lukehagar/plexjs"; + +let value: Location = { + id: 1, + path: "/movies", +}; +``` ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | -| `code` | *string* | :heavy_minus_sign: | N/A | US | -| `europeanUnionMember` | *boolean* | :heavy_minus_sign: | N/A | | -| `continentCode` | *string* | :heavy_minus_sign: | N/A | NA | -| `country` | *string* | :heavy_minus_sign: | N/A | United States | -| `city` | *string* | :heavy_minus_sign: | N/A | Austin | -| `timeZone` | *string* | :heavy_minus_sign: | N/A | America/Chicago | -| `postalCode` | *string* | :heavy_minus_sign: | N/A | 78732 | -| `inPrivacyRestrictedCountry` | *boolean* | :heavy_minus_sign: | N/A | | -| `subdivisions` | *string* | :heavy_minus_sign: | N/A | Texas | -| `coordinates` | *string* | :heavy_minus_sign: | N/A | 30.3768 -97.8935 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *number* | :heavy_minus_sign: | N/A | 1 | +| `path` | *string* | :heavy_minus_sign: | N/A | /movies | \ No newline at end of file diff --git a/docs/models/loglineerrors.md b/docs/models/loglineerrors.md index 7c095b3a..d092654f 100644 --- a/docs/models/loglineerrors.md +++ b/docs/models/loglineerrors.md @@ -1,5 +1,16 @@ # LogLineErrors +## Example Usage + +```typescript +import { LogLineErrors } from "@lukehagar/plexjs"; + +let value: LogLineErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/loglinerequest.md b/docs/models/loglinerequest.md index 6a12b92d..f38f7e7c 100644 --- a/docs/models/loglinerequest.md +++ b/docs/models/loglinerequest.md @@ -1,5 +1,16 @@ # LogLineRequest +## Example Usage + +```typescript +import { Level, LogLineRequest } from "@lukehagar/plexjs"; + +let value: LogLineRequest = { + level: Level.Two, + message: "Test log message", + source: "Postman", +}; +``` ## Fields diff --git a/docs/models/loglineresponse.md b/docs/models/loglineresponse.md index 210a9f55..a5679e8c 100644 --- a/docs/models/loglineresponse.md +++ b/docs/models/loglineresponse.md @@ -1,5 +1,18 @@ # LogLineResponse +## Example Usage + +```typescript +import { LogLineResponse } from "@lukehagar/plexjs"; + +let value: LogLineResponse = { + contentType: "", + statusCode: 902349, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/loglineresponsebody.md b/docs/models/loglineresponsebody.md index 0c38f1e5..e437cd6e 100644 --- a/docs/models/loglineresponsebody.md +++ b/docs/models/loglineresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { LogLineResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/logmultilineerrors.md b/docs/models/logmultilineerrors.md index 85bbecde..5157acff 100644 --- a/docs/models/logmultilineerrors.md +++ b/docs/models/logmultilineerrors.md @@ -1,5 +1,16 @@ # LogMultiLineErrors +## Example Usage + +```typescript +import { LogMultiLineErrors } from "@lukehagar/plexjs"; + +let value: LogMultiLineErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/logmultilineresponse.md b/docs/models/logmultilineresponse.md index 4ccd754e..6167f0e3 100644 --- a/docs/models/logmultilineresponse.md +++ b/docs/models/logmultilineresponse.md @@ -1,5 +1,18 @@ # LogMultiLineResponse +## Example Usage + +```typescript +import { LogMultiLineResponse } from "@lukehagar/plexjs"; + +let value: LogMultiLineResponse = { + contentType: "", + statusCode: 697631, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/logmultilineresponsebody.md b/docs/models/logmultilineresponsebody.md index c4987710..c9f18e36 100644 --- a/docs/models/logmultilineresponsebody.md +++ b/docs/models/logmultilineresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { LogMultiLineResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/mailingliststatus.md b/docs/models/mailingliststatus.md new file mode 100644 index 00000000..ea311917 --- /dev/null +++ b/docs/models/mailingliststatus.md @@ -0,0 +1,18 @@ +# MailingListStatus + +Your current mailing list status + +## Example Usage + +```typescript +import { MailingListStatus } from "@lukehagar/plexjs"; + +let value: MailingListStatus = MailingListStatus.Unsubscribed; +``` + +## Values + +| Name | Value | +| -------------- | -------------- | +| `Subscribed` | subscribed | +| `Unsubscribed` | unsubscribed | \ No newline at end of file diff --git a/docs/models/markplayederrors.md b/docs/models/markplayederrors.md index b1916a24..c6eb1657 100644 --- a/docs/models/markplayederrors.md +++ b/docs/models/markplayederrors.md @@ -1,5 +1,16 @@ # MarkPlayedErrors +## Example Usage + +```typescript +import { MarkPlayedErrors } from "@lukehagar/plexjs"; + +let value: MarkPlayedErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/markplayedrequest.md b/docs/models/markplayedrequest.md index de834efb..3274dbdb 100644 --- a/docs/models/markplayedrequest.md +++ b/docs/models/markplayedrequest.md @@ -1,5 +1,14 @@ # MarkPlayedRequest +## Example Usage + +```typescript +import { MarkPlayedRequest } from "@lukehagar/plexjs"; + +let value: MarkPlayedRequest = { + key: 59398, +}; +``` ## Fields diff --git a/docs/models/markplayedresponse.md b/docs/models/markplayedresponse.md index 9787c0b2..08b066f1 100644 --- a/docs/models/markplayedresponse.md +++ b/docs/models/markplayedresponse.md @@ -1,5 +1,18 @@ # MarkPlayedResponse +## Example Usage + +```typescript +import { MarkPlayedResponse } from "@lukehagar/plexjs"; + +let value: MarkPlayedResponse = { + contentType: "", + statusCode: 297534, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/markplayedresponsebody.md b/docs/models/markplayedresponsebody.md index 81de8e57..0db37673 100644 --- a/docs/models/markplayedresponsebody.md +++ b/docs/models/markplayedresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { MarkPlayedResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/markunplayederrors.md b/docs/models/markunplayederrors.md index 4ffd3da1..55841bcf 100644 --- a/docs/models/markunplayederrors.md +++ b/docs/models/markunplayederrors.md @@ -1,5 +1,16 @@ # MarkUnplayedErrors +## Example Usage + +```typescript +import { MarkUnplayedErrors } from "@lukehagar/plexjs"; + +let value: MarkUnplayedErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/markunplayedrequest.md b/docs/models/markunplayedrequest.md index 3715fb83..fd49d221 100644 --- a/docs/models/markunplayedrequest.md +++ b/docs/models/markunplayedrequest.md @@ -1,5 +1,14 @@ # MarkUnplayedRequest +## Example Usage + +```typescript +import { MarkUnplayedRequest } from "@lukehagar/plexjs"; + +let value: MarkUnplayedRequest = { + key: 59398, +}; +``` ## Fields diff --git a/docs/models/markunplayedresponse.md b/docs/models/markunplayedresponse.md index 7ae6b2d6..54f895d2 100644 --- a/docs/models/markunplayedresponse.md +++ b/docs/models/markunplayedresponse.md @@ -1,5 +1,18 @@ # MarkUnplayedResponse +## Example Usage + +```typescript +import { MarkUnplayedResponse } from "@lukehagar/plexjs"; + +let value: MarkUnplayedResponse = { + contentType: "", + statusCode: 891773, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/markunplayedresponsebody.md b/docs/models/markunplayedresponsebody.md index c45e8c8a..1aa1f9e6 100644 --- a/docs/models/markunplayedresponsebody.md +++ b/docs/models/markunplayedresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { MarkUnplayedResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/mediacontainer.md b/docs/models/mediacontainer.md index b11c82f7..b5b8ff8f 100644 --- a/docs/models/mediacontainer.md +++ b/docs/models/mediacontainer.md @@ -1,5 +1,12 @@ # MediaContainer +## Example Usage + +```typescript +import { MediaContainer } from "@lukehagar/plexjs"; + +let value: MediaContainer = {}; +``` ## Fields diff --git a/docs/models/metadata.md b/docs/models/metadata.md index 7c946750..b8afb175 100644 --- a/docs/models/metadata.md +++ b/docs/models/metadata.md @@ -1,5 +1,12 @@ # Metadata +## Example Usage + +```typescript +import { Metadata } from "@lukehagar/plexjs"; + +let value: Metadata = {}; +``` ## Fields diff --git a/docs/models/minsize.md b/docs/models/minsize.md index cb991b55..de1381ac 100644 --- a/docs/models/minsize.md +++ b/docs/models/minsize.md @@ -2,6 +2,13 @@ images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against. +## Example Usage + +```typescript +import { MinSize } from "@lukehagar/plexjs"; + +let value: MinSize = MinSize.One; +``` ## Values diff --git a/docs/models/myplex.md b/docs/models/myplex.md index 64a6f48e..d47646fa 100644 --- a/docs/models/myplex.md +++ b/docs/models/myplex.md @@ -1,5 +1,24 @@ # MyPlex +## Example Usage + +```typescript +import { MyPlex } from "@lukehagar/plexjs"; + +let value: MyPlex = { + authToken: "Z5v-PrNASDFpsaCi3CPK7", + username: "example.email@mail.com", + mappingState: "mapped", + signInState: "ok", + publicAddress: "140.20.68.140", + publicPort: 32400, + privateAddress: "10.10.10.47", + privatePort: 32400, + subscriptionFeatures: + "federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks", + subscriptionState: "Active", +}; +``` ## Fields diff --git a/docs/models/onlytransient.md b/docs/models/onlytransient.md index 763848f5..a33351b5 100644 --- a/docs/models/onlytransient.md +++ b/docs/models/onlytransient.md @@ -2,6 +2,13 @@ Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). +## Example Usage + +```typescript +import { OnlyTransient } from "@lukehagar/plexjs"; + +let value: OnlyTransient = OnlyTransient.One; +``` ## Values diff --git a/docs/models/operator.md b/docs/models/operator.md index 7ad9ac50..204834fe 100644 --- a/docs/models/operator.md +++ b/docs/models/operator.md @@ -1,5 +1,15 @@ # Operator +## Example Usage + +```typescript +import { Operator } from "@lukehagar/plexjs"; + +let value: Operator = { + key: "=", + title: "is", +}; +``` ## Fields diff --git a/docs/models/part.md b/docs/models/part.md index 1507a994..182b1337 100644 --- a/docs/models/part.md +++ b/docs/models/part.md @@ -1,5 +1,21 @@ # Part +## Example Usage + +```typescript +import { Part } from "@lukehagar/plexjs"; + +let value: Part = { + id: 120353, + key: "/library/parts/120353/1681803203/file.mp4", + duration: 7474422, + file: "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4", + size: 3395307162, + container: "mp4", + hasThumbnail: 1, + videoProfile: "high", +}; +``` ## Fields diff --git a/docs/models/pastsubscription.md b/docs/models/pastsubscription.md new file mode 100644 index 00000000..47bfdea1 --- /dev/null +++ b/docs/models/pastsubscription.md @@ -0,0 +1,50 @@ +# PastSubscription + +## Example Usage + +```typescript +import { PastSubscription, PostUsersSigninDataState } from "@lukehagar/plexjs"; + +let value: PastSubscription = { + id: "", + mode: "", + renewsAt: 662527, + endsAt: 1556281940, + canceled: false, + gracePeriod: false, + onHold: false, + canReactivate: false, + canUpgrade: false, + canDowngrade: false, + canConvert: false, + type: "plexpass", + transfer: "", + state: PostUsersSigninDataState.Ended, + billing: [ + { + internalPaymentMethod: {}, + paymentMethodId: 820994, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | | +| `mode` | *string* | :heavy_check_mark: | N/A | | +| `renewsAt` | *number* | :heavy_check_mark: | Unix epoch datetime | | +| `endsAt` | *number* | :heavy_check_mark: | Unix epoch datetime | 1556281940 | +| `canceled` | *boolean* | :heavy_minus_sign: | N/A | false | +| `gracePeriod` | *boolean* | :heavy_minus_sign: | N/A | false | +| `onHold` | *boolean* | :heavy_minus_sign: | N/A | false | +| `canReactivate` | *boolean* | :heavy_minus_sign: | N/A | false | +| `canUpgrade` | *boolean* | :heavy_minus_sign: | N/A | false | +| `canDowngrade` | *boolean* | :heavy_minus_sign: | N/A | false | +| `canConvert` | *boolean* | :heavy_minus_sign: | N/A | false | +| `type` | *string* | :heavy_check_mark: | N/A | plexpass | +| `transfer` | *string* | :heavy_check_mark: | N/A | | +| `state` | [models.PostUsersSigninDataState](../models/postuserssignindatastate.md) | :heavy_check_mark: | N/A | ended | +| `billing` | [models.Billing](../models/billing.md)[] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/pathparamfilter.md b/docs/models/pathparamfilter.md index 150c2a30..99983e20 100644 --- a/docs/models/pathparamfilter.md +++ b/docs/models/pathparamfilter.md @@ -2,6 +2,13 @@ Filter +## Example Usage + +```typescript +import { PathParamFilter } from "@lukehagar/plexjs"; + +let value: PathParamFilter = PathParamFilter.All; +``` ## Values diff --git a/docs/models/pathparamtaskname.md b/docs/models/pathparamtaskname.md index 650e15c2..c9693160 100644 --- a/docs/models/pathparamtaskname.md +++ b/docs/models/pathparamtaskname.md @@ -2,6 +2,13 @@ The name of the task to be started. +## Example Usage + +```typescript +import { PathParamTaskName } from "@lukehagar/plexjs"; + +let value: PathParamTaskName = PathParamTaskName.RefreshPeriodicMetadata; +``` ## Values diff --git a/docs/models/performsearcherrors.md b/docs/models/performsearcherrors.md index 8b88ac3e..b6a6d501 100644 --- a/docs/models/performsearcherrors.md +++ b/docs/models/performsearcherrors.md @@ -1,5 +1,16 @@ # PerformSearchErrors +## Example Usage + +```typescript +import { PerformSearchErrors } from "@lukehagar/plexjs"; + +let value: PerformSearchErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/performsearchrequest.md b/docs/models/performsearchrequest.md index 6d71ca60..d811a67f 100644 --- a/docs/models/performsearchrequest.md +++ b/docs/models/performsearchrequest.md @@ -1,5 +1,15 @@ # PerformSearchRequest +## Example Usage + +```typescript +import { PerformSearchRequest } from "@lukehagar/plexjs"; + +let value: PerformSearchRequest = { + query: "dylan", + limit: 5, +}; +``` ## Fields diff --git a/docs/models/performsearchresponse.md b/docs/models/performsearchresponse.md index a6b4edb9..eeceae3a 100644 --- a/docs/models/performsearchresponse.md +++ b/docs/models/performsearchresponse.md @@ -1,5 +1,18 @@ # PerformSearchResponse +## Example Usage + +```typescript +import { PerformSearchResponse } from "@lukehagar/plexjs"; + +let value: PerformSearchResponse = { + contentType: "", + statusCode: 758616, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/performsearchresponsebody.md b/docs/models/performsearchresponsebody.md index c544497c..00d5c69f 100644 --- a/docs/models/performsearchresponsebody.md +++ b/docs/models/performsearchresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { PerformSearchResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/performvoicesearcherrors.md b/docs/models/performvoicesearcherrors.md index dd048049..fd8c5daa 100644 --- a/docs/models/performvoicesearcherrors.md +++ b/docs/models/performvoicesearcherrors.md @@ -1,5 +1,16 @@ # PerformVoiceSearchErrors +## Example Usage + +```typescript +import { PerformVoiceSearchErrors } from "@lukehagar/plexjs"; + +let value: PerformVoiceSearchErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/performvoicesearchrequest.md b/docs/models/performvoicesearchrequest.md index 61e1c187..042e3f1a 100644 --- a/docs/models/performvoicesearchrequest.md +++ b/docs/models/performvoicesearchrequest.md @@ -1,5 +1,15 @@ # PerformVoiceSearchRequest +## Example Usage + +```typescript +import { PerformVoiceSearchRequest } from "@lukehagar/plexjs"; + +let value: PerformVoiceSearchRequest = { + query: "dead+poop", + limit: 5, +}; +``` ## Fields diff --git a/docs/models/performvoicesearchresponse.md b/docs/models/performvoicesearchresponse.md index b345a2b1..1d0da9cc 100644 --- a/docs/models/performvoicesearchresponse.md +++ b/docs/models/performvoicesearchresponse.md @@ -1,5 +1,18 @@ # PerformVoiceSearchResponse +## Example Usage + +```typescript +import { PerformVoiceSearchResponse } from "@lukehagar/plexjs"; + +let value: PerformVoiceSearchResponse = { + contentType: "", + statusCode: 521848, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/performvoicesearchresponsebody.md b/docs/models/performvoicesearchresponsebody.md index 18c62b9e..8f63a0a9 100644 --- a/docs/models/performvoicesearchresponsebody.md +++ b/docs/models/performvoicesearchresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { PerformVoiceSearchResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/player.md b/docs/models/player.md index 59ac3f8b..dde0e062 100644 --- a/docs/models/player.md +++ b/docs/models/player.md @@ -1,5 +1,28 @@ # Player +## Example Usage + +```typescript +import { Player } from "@lukehagar/plexjs"; + +let value: Player = { + address: "10.10.10.171", + machineIdentifier: "3tsdzir85m2onc3qyr255aq1", + model: "standalone", + platform: "windows", + platformVersion: "10.0.22621", + product: "Plex for Windows", + profile: "Plex Desktop", + remotePublicAddress: "68.248.140.20", + state: "playing", + title: "DESKTOP-BL80MTD", + version: "1.85.0.4071-21128b56", + local: true, + relayed: false, + secure: true, + userID: 1, +}; +``` ## Fields diff --git a/docs/models/playlisttype.md b/docs/models/playlisttype.md index c09c1e58..ea8a64d4 100644 --- a/docs/models/playlisttype.md +++ b/docs/models/playlisttype.md @@ -2,6 +2,13 @@ limit to a type of playlist. +## Example Usage + +```typescript +import { PlaylistType } from "@lukehagar/plexjs"; + +let value: PlaylistType = PlaylistType.Photo; +``` ## Values diff --git a/docs/models/plexdevice.md b/docs/models/plexdevice.md new file mode 100644 index 00000000..3bf8f2b6 --- /dev/null +++ b/docs/models/plexdevice.md @@ -0,0 +1,49 @@ +# PlexDevice + +## Example Usage + +```typescript +import { PlexDevice } from "@lukehagar/plexjs"; + +let value: PlexDevice = { + name: "", + product: "Oriental Bronze Pizza", + productVersion: "", + platform: "", + platformVersion: "", + device: "", + clientIdentifier: "", + createdAt: new Date("2024-08-11T14:46:30.188Z"), + lastSeenAt: new Date("2024-12-08T13:34:36.810Z"), + provides: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `name` | *string* | :heavy_check_mark: | N/A | +| `product` | *string* | :heavy_check_mark: | N/A | +| `productVersion` | *string* | :heavy_check_mark: | N/A | +| `platform` | *string* | :heavy_check_mark: | N/A | +| `platformVersion` | *string* | :heavy_check_mark: | N/A | +| `device` | *string* | :heavy_check_mark: | N/A | +| `clientIdentifier` | *string* | :heavy_check_mark: | N/A | +| `createdAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | +| `lastSeenAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | +| `provides` | *string* | :heavy_check_mark: | N/A | +| `ownerId` | *string* | :heavy_minus_sign: | N/A | +| `sourceTitle` | *string* | :heavy_minus_sign: | N/A | +| `publicAddress` | *string* | :heavy_minus_sign: | N/A | +| `accessToken` | *string* | :heavy_minus_sign: | N/A | +| `owned` | *boolean* | :heavy_minus_sign: | N/A | +| `home` | *boolean* | :heavy_minus_sign: | N/A | +| `synced` | *boolean* | :heavy_minus_sign: | N/A | +| `relay` | *boolean* | :heavy_minus_sign: | N/A | +| `presence` | *boolean* | :heavy_minus_sign: | N/A | +| `httpsRequired` | *boolean* | :heavy_minus_sign: | N/A | +| `publicAddressMatches` | *boolean* | :heavy_minus_sign: | N/A | +| `dnsRebindingProtection` | *boolean* | :heavy_minus_sign: | N/A | +| `natLoopbackSupported` | *boolean* | :heavy_minus_sign: | N/A | +| `connections` | [models.Connections](../models/connections.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/postuserssignindataerrors.md b/docs/models/postuserssignindataerrors.md new file mode 100644 index 00000000..69d2e589 --- /dev/null +++ b/docs/models/postuserssignindataerrors.md @@ -0,0 +1,21 @@ +# PostUsersSigninDataErrors + +## Example Usage + +```typescript +import { PostUsersSigninDataErrors } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *number* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *number* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/postuserssignindatafeatures.md b/docs/models/postuserssignindatafeatures.md new file mode 100644 index 00000000..6ffd274b --- /dev/null +++ b/docs/models/postuserssignindatafeatures.md @@ -0,0 +1,73 @@ +# PostUsersSigninDataFeatures + +## Example Usage + +```typescript +import { PostUsersSigninDataFeatures } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataFeatures = PostUsersSigninDataFeatures.ClientRadioStations; +``` + +## Values + +| Name | Value | +| --------------------------------------- | --------------------------------------- | +| `AndroidDolbyVision` | Android - Dolby Vision | +| `AndroidPiP` | Android - PiP | +| `CUSunset` | CU Sunset | +| `HRKEnableEUR` | HRK_enable_EUR | +| `TREBLEShowFeatures` | TREBLE-show-features | +| `AdCountdownTimer` | ad-countdown-timer | +| `AdaptiveBitrate` | adaptive_bitrate | +| `AmazonLoopDebug` | amazon-loop-debug | +| `AvodAdAnalysis` | avod-ad-analysis | +| `AvodNewMedia` | avod-new-media | +| `BlacklistGetSignin` | blacklist_get_signin | +| `ClientRadioStations` | client-radio-stations | +| `CloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `Collections` | collections | +| `CommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `CommunityAccessPlexTv` | community_access_plex_tv | +| `CompanionsSonos` | companions_sonos | +| `CustomHomeRemoval` | custom-home-removal | +| `DisableHomeUserFriendships` | disable_home_user_friendships | +| `DisableSharingFriendships` | disable_sharing_friendships | +| `DrmSupport` | drm_support | +| `ExcludeRestrictions` | exclude restrictions | +| `FederatedAuth` | federated-auth | +| `FriendRequestPushNotifications` | friend_request_push_notifications | +| `GuidedUpgrade` | guided-upgrade | +| `Home` | home | +| `IncreasePasswordComplexity` | increase-password-complexity | +| `Ios14PrivacyBanner` | ios14-privacy-banner | +| `IterableNotificationTokens` | iterable-notification-tokens | +| `KeepPaymentMethod` | keep-payment-method | +| `KevinBacon` | kevin-bacon | +| `KoreaConsent` | korea-consent | +| `LeIsrgRootX1` | le_isrg_root_x1 | +| `LetsEncrypt` | lets_encrypt | +| `LightningDvrPivot` | lightning-dvr-pivot | +| `LiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `Livetv` | livetv | +| `MetadataSearch` | metadata_search | +| `NewPlexPassPrices` | new_plex_pass_prices | +| `NewsProviderSunsetModal` | news-provider-sunset-modal | +| `PhotosFavorites` | photos-favorites | +| `PhotosMetadataEdition` | photos-metadata-edition | +| `PmsHealth` | pms_health | +| `Radio` | radio | +| `RateLimitClientToken` | rate-limit-client-token | +| `ScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `SharedServerNotification` | shared_server_notification | +| `SharedSourceNotification` | shared_source_notification | +| `SigninWithApple` | signin_with_apple | +| `SpringServeAdProvider` | spring_serve_ad_provider | +| `TranscoderCache` | transcoder_cache | +| `TunerSharing` | tuner-sharing | +| `TwoFactorAuthentication` | two-factor-authentication | +| `Unsupportedtuners` | unsupportedtuners | +| `Upgrade3ds2` | upgrade-3ds2 | +| `VodSchema` | vod-schema | +| `VodCloudflare` | vod_cloudflare | +| `WatchTogetherInvite` | watch-together-invite | +| `WebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/postuserssignindataglobals.md b/docs/models/postuserssignindataglobals.md new file mode 100644 index 00000000..912da2a7 --- /dev/null +++ b/docs/models/postuserssignindataglobals.md @@ -0,0 +1,15 @@ +# PostUsersSigninDataGlobals + +## Example Usage + +```typescript +import { PostUsersSigninDataGlobals } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file diff --git a/docs/models/postuserssignindatamailingliststatus.md b/docs/models/postuserssignindatamailingliststatus.md new file mode 100644 index 00000000..1f4fb999 --- /dev/null +++ b/docs/models/postuserssignindatamailingliststatus.md @@ -0,0 +1,18 @@ +# PostUsersSigninDataMailingListStatus + +Your current mailing list status + +## Example Usage + +```typescript +import { PostUsersSigninDataMailingListStatus } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataMailingListStatus = PostUsersSigninDataMailingListStatus.Unsubscribed; +``` + +## Values + +| Name | Value | +| -------------- | -------------- | +| `Subscribed` | subscribed | +| `Unsubscribed` | unsubscribed | \ No newline at end of file diff --git a/docs/models/postuserssignindatarequest.md b/docs/models/postuserssignindatarequest.md new file mode 100644 index 00000000..dcd156c3 --- /dev/null +++ b/docs/models/postuserssignindatarequest.md @@ -0,0 +1,21 @@ +# PostUsersSigninDataRequest + +## Example Usage + +```typescript +import { PostUsersSigninDataRequest } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataRequest = { + requestBody: { + login: "username@email.com", + password: "password123", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | +| `requestBody` | [models.PostUsersSigninDataRequestBody](../models/postuserssignindatarequestbody.md) | :heavy_minus_sign: | Login credentials | | \ No newline at end of file diff --git a/docs/models/postuserssignindatarequestbody.md b/docs/models/postuserssignindatarequestbody.md new file mode 100644 index 00000000..7871d335 --- /dev/null +++ b/docs/models/postuserssignindatarequestbody.md @@ -0,0 +1,22 @@ +# PostUsersSigninDataRequestBody + +Login credentials + +## Example Usage + +```typescript +import { PostUsersSigninDataRequestBody } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataRequestBody = { + login: "username@email.com", + password: "password123", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `login` | *string* | :heavy_check_mark: | N/A | username@email.com | +| `password` | *string* | :heavy_check_mark: | N/A | password123 | +| `rememberMe` | *boolean* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/postuserssignindataresponse.md b/docs/models/postuserssignindataresponse.md new file mode 100644 index 00000000..c4cbb2f9 --- /dev/null +++ b/docs/models/postuserssignindataresponse.md @@ -0,0 +1,135 @@ +# PostUsersSigninDataResponse + +## Example Usage + +```typescript +import { + PostUsersSigninDataFeatures, + PostUsersSigninDataMailingListStatus, + PostUsersSigninDataResponse, + PostUsersSigninDataState, + PostUsersSigninDataStatus, + PostUsersSigninDataUserFeatures, + PostUsersSigninDataUserResponseStatus, + PostUsersSigninDataUserStatus, +} from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataResponse = { + contentType: "", + statusCode: 13571, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + userPlexAccount: { + adsConsent: true, + adsConsentReminderAt: new Date("2019-08-24T14:15:22Z"), + adsConsentSetAt: new Date("2019-08-24T14:15:22Z"), + anonymous: false, + authToken: "CxoUzBTSV5hsxjTpFKaf", + backupCodesCreated: false, + confirmed: false, + country: "US", + email: "username@email.com", + emailOnlyAuth: false, + experimentalFeatures: false, + friendlyName: "friendlyUsername", + entitlements: ["[]"], + guest: false, + hasPassword: true, + home: false, + homeAdmin: false, + homeSize: 1, + id: 13692262, + joinedAt: 1721154902, + locale: null, + mailingListActive: false, + mailingListStatus: PostUsersSigninDataMailingListStatus.Subscribed, + maxHomeSize: 15, + pin: "string", + profile: [ + { + autoSelectAudio: true, + defaultAudioLanguage: "ja", + defaultSubtitleLanguage: "en", + autoSelectSubtitle: 1, + defaultSubtitleAccessibility: 1, + defaultSubtitleForced: 0, + watchedIndicator: 1, + mediaReviewsVisibility: 0, + }, + ], + protected: false, + rememberExpiresAt: 1722364046, + restricted: false, + roles: ["string"], + scrobbleTypes: "", + services: [ + { + identifier: "metadata-dev", + endpoint: "https://epg.provider.plex.tv", + token: "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", + secret: "string", + status: PostUsersSigninDataStatus.Online, + }, + ], + subscription: { + features: [PostUsersSigninDataFeatures.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: PostUsersSigninDataUserStatus.Inactive, + paymentService: "string", + plan: "string", + }, + subscriptionDescription: "string", + subscriptions: [ + { + features: [PostUsersSigninDataUserFeatures.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: PostUsersSigninDataUserResponseStatus.Inactive, + paymentService: "string", + plan: "string", + }, + ], + thumb: "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", + title: "UsernameTitle", + twoFactorEnabled: false, + username: "Username", + uuid: "dae343c1f45beb4f", + pastSubscriptions: [ + { + id: "string", + mode: "string", + renewsAt: string, + endsAt: 1556281940, + canceled: true, + gracePeriod: true, + onHold: true, + canReactivate: true, + canUpgrade: true, + canDowngrade: true, + canConvert: true, + type: "plexpass", + transfer: "string", + state: PostUsersSigninDataState.Ended, + billing: [ + { + internalPaymentMethod: {}, + paymentMethodId: string, + }, + ], + }, + ], + trials: [{}], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `userPlexAccount` | [models.PostUsersSigninDataUserPlexAccount](../models/postuserssignindatauserplexaccount.md) | :heavy_minus_sign: | Returns the user account data with a valid auth token | {
"adsConsent": true,
"adsConsentReminderAt": "2019-08-24T14:15:22Z",
"adsConsentSetAt": "2019-08-24T14:15:22Z",
"anonymous": false,
"authToken": "CxoUzBTSV5hsxjTpFKaf",
"backupCodesCreated": false,
"confirmed": false,
"country": "US",
"email": "username@email.com",
"emailOnlyAuth": false,
"experimentalFeatures": false,
"friendlyName": "friendlyUsername",
"entitlements": [],
"guest": false,
"hasPassword": true,
"home": false,
"homeAdmin": false,
"homeSize": 1,
"id": 13692262,
"joinedAt": 1721154902,
"locale": null,
"mailingListActive": false,
"mailingListStatus": "subscribed",
"maxHomeSize": 15,
"pastSubscriptions": [
{
"id": "string",
"mode": "string",
"renewsAt": "string",
"endsAt": "1556281940",
"canceled": "0",
"gracePeriod": "0",
"onHold": "0",
"canReactivate": "0",
"canUpgrade": "0",
"canDowngrade": "0",
"canConvert": "0",
"type": "plexpass",
"transfer": "string",
"state": "ended",
"billing": [
{
"internalPaymentMethod": "string",
"paymentMethodId": "string"
}
]
}
],
"pin": "string",
"profile": [
{
"autoSelectAudio": true,
"defaultAudioLanguage": "ja",
"defaultSubtitleLanguage": "en",
"autoSelectSubtitle": 1,
"defaultSubtitleAccessibility": 1,
"defaultSubtitleForced": 0,
"watchedIndicator": 1,
"mediaReviewsVisibility": 0
}
],
"protected": false,
"rememberExpiresAt": 1722364046,
"restricted": false,
"roles": [
"string"
],
"scrobbleTypes": "",
"services": [
{
"identifier": "metadata-dev",
"endpoint": "https://epg.provider.plex.tv",
"token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
"secret": "string",
"status": "online"
}
],
"subscription": {
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
},
"subscriptionDescription": "string",
"subscriptions": [
{
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
}
],
"thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
"title": "UsernameTitle",
"trials": [
{}
],
"twoFactorEnabled": false,
"username": "Username",
"uuid": "dae343c1f45beb4f"
} | \ No newline at end of file diff --git a/docs/models/postuserssignindataresponsebody.md b/docs/models/postuserssignindataresponsebody.md new file mode 100644 index 00000000..225546cc --- /dev/null +++ b/docs/models/postuserssignindataresponsebody.md @@ -0,0 +1,18 @@ +# PostUsersSigninDataResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + +## Example Usage + +```typescript +import { PostUsersSigninDataResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `errors` | [models.PostUsersSigninDataErrors](../models/postuserssignindataerrors.md)[] | :heavy_minus_sign: | N/A | +| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/postuserssignindataservices.md b/docs/models/postuserssignindataservices.md new file mode 100644 index 00000000..1989ca5e --- /dev/null +++ b/docs/models/postuserssignindataservices.md @@ -0,0 +1,25 @@ +# PostUsersSigninDataServices + +## Example Usage + +```typescript +import { PostUsersSigninDataServices, PostUsersSigninDataStatus } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataServices = { + identifier: "metadata-dev", + endpoint: "https://epg.provider.plex.tv", + token: "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", + secret: "", + status: PostUsersSigninDataStatus.Online, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `identifier` | *string* | :heavy_check_mark: | N/A | metadata-dev | +| `endpoint` | *string* | :heavy_check_mark: | N/A | https://epg.provider.plex.tv | +| `token` | *string* | :heavy_check_mark: | N/A | DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv | +| `secret` | *string* | :heavy_check_mark: | N/A | | +| `status` | [models.PostUsersSigninDataStatus](../models/postuserssignindatastatus.md) | :heavy_check_mark: | N/A | online | \ No newline at end of file diff --git a/docs/models/postuserssignindatastate.md b/docs/models/postuserssignindatastate.md new file mode 100644 index 00000000..0ade6cfc --- /dev/null +++ b/docs/models/postuserssignindatastate.md @@ -0,0 +1,15 @@ +# PostUsersSigninDataState + +## Example Usage + +```typescript +import { PostUsersSigninDataState } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataState = PostUsersSigninDataState.Ended; +``` + +## Values + +| Name | Value | +| ------- | ------- | +| `Ended` | ended | \ No newline at end of file diff --git a/docs/models/postuserssignindatastatus.md b/docs/models/postuserssignindatastatus.md new file mode 100644 index 00000000..2b9f0d92 --- /dev/null +++ b/docs/models/postuserssignindatastatus.md @@ -0,0 +1,16 @@ +# PostUsersSigninDataStatus + +## Example Usage + +```typescript +import { PostUsersSigninDataStatus } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataStatus = PostUsersSigninDataStatus.Online; +``` + +## Values + +| Name | Value | +| --------- | --------- | +| `Online` | online | +| `Offline` | offline | \ No newline at end of file diff --git a/docs/models/postuserssignindatasubscription.md b/docs/models/postuserssignindatasubscription.md new file mode 100644 index 00000000..0dcf74fa --- /dev/null +++ b/docs/models/postuserssignindatasubscription.md @@ -0,0 +1,26 @@ +# PostUsersSigninDataSubscription + +If the account’s Plex Pass subscription is active + +## Example Usage + +```typescript +import { PostUsersSigninDataSubscription, PostUsersSigninDataUserStatus } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataSubscription = { + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: PostUsersSigninDataUserStatus.Inactive, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `features` | [models.PostUsersSigninDataFeatures](../models/postuserssignindatafeatures.md)[] | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `active` | *boolean* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `subscribedAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `status` | [models.PostUsersSigninDataUserStatus](../models/postuserssignindatauserstatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `paymentService` | *string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `plan` | *string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/postuserssignindatauserfeatures.md b/docs/models/postuserssignindatauserfeatures.md new file mode 100644 index 00000000..bf31bb3f --- /dev/null +++ b/docs/models/postuserssignindatauserfeatures.md @@ -0,0 +1,73 @@ +# PostUsersSigninDataUserFeatures + +## Example Usage + +```typescript +import { PostUsersSigninDataUserFeatures } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataUserFeatures = PostUsersSigninDataUserFeatures.VodCloudflare; +``` + +## Values + +| Name | Value | +| --------------------------------------- | --------------------------------------- | +| `AndroidDolbyVision` | Android - Dolby Vision | +| `AndroidPiP` | Android - PiP | +| `CUSunset` | CU Sunset | +| `HRKEnableEUR` | HRK_enable_EUR | +| `TREBLEShowFeatures` | TREBLE-show-features | +| `AdCountdownTimer` | ad-countdown-timer | +| `AdaptiveBitrate` | adaptive_bitrate | +| `AmazonLoopDebug` | amazon-loop-debug | +| `AvodAdAnalysis` | avod-ad-analysis | +| `AvodNewMedia` | avod-new-media | +| `BlacklistGetSignin` | blacklist_get_signin | +| `ClientRadioStations` | client-radio-stations | +| `CloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `Collections` | collections | +| `CommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `CommunityAccessPlexTv` | community_access_plex_tv | +| `CompanionsSonos` | companions_sonos | +| `CustomHomeRemoval` | custom-home-removal | +| `DisableHomeUserFriendships` | disable_home_user_friendships | +| `DisableSharingFriendships` | disable_sharing_friendships | +| `DrmSupport` | drm_support | +| `ExcludeRestrictions` | exclude restrictions | +| `FederatedAuth` | federated-auth | +| `FriendRequestPushNotifications` | friend_request_push_notifications | +| `GuidedUpgrade` | guided-upgrade | +| `Home` | home | +| `IncreasePasswordComplexity` | increase-password-complexity | +| `Ios14PrivacyBanner` | ios14-privacy-banner | +| `IterableNotificationTokens` | iterable-notification-tokens | +| `KeepPaymentMethod` | keep-payment-method | +| `KevinBacon` | kevin-bacon | +| `KoreaConsent` | korea-consent | +| `LeIsrgRootX1` | le_isrg_root_x1 | +| `LetsEncrypt` | lets_encrypt | +| `LightningDvrPivot` | lightning-dvr-pivot | +| `LiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `Livetv` | livetv | +| `MetadataSearch` | metadata_search | +| `NewPlexPassPrices` | new_plex_pass_prices | +| `NewsProviderSunsetModal` | news-provider-sunset-modal | +| `PhotosFavorites` | photos-favorites | +| `PhotosMetadataEdition` | photos-metadata-edition | +| `PmsHealth` | pms_health | +| `Radio` | radio | +| `RateLimitClientToken` | rate-limit-client-token | +| `ScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `SharedServerNotification` | shared_server_notification | +| `SharedSourceNotification` | shared_source_notification | +| `SigninWithApple` | signin_with_apple | +| `SpringServeAdProvider` | spring_serve_ad_provider | +| `TranscoderCache` | transcoder_cache | +| `TunerSharing` | tuner-sharing | +| `TwoFactorAuthentication` | two-factor-authentication | +| `Unsupportedtuners` | unsupportedtuners | +| `Upgrade3ds2` | upgrade-3ds2 | +| `VodSchema` | vod-schema | +| `VodCloudflare` | vod_cloudflare | +| `WatchTogetherInvite` | watch-together-invite | +| `WebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/postuserssignindatauserplexaccount.md b/docs/models/postuserssignindatauserplexaccount.md new file mode 100644 index 00000000..fa33ae81 --- /dev/null +++ b/docs/models/postuserssignindatauserplexaccount.md @@ -0,0 +1,168 @@ +# PostUsersSigninDataUserPlexAccount + +Returns the user account data with a valid auth token + +## Example Usage + +```typescript +import { + PostUsersSigninDataFeatures, + PostUsersSigninDataMailingListStatus, + PostUsersSigninDataState, + PostUsersSigninDataStatus, + PostUsersSigninDataUserFeatures, + PostUsersSigninDataUserPlexAccount, + PostUsersSigninDataUserResponseStatus, + PostUsersSigninDataUserStatus, +} from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataUserPlexAccount = { + adsConsent: true, + adsConsentReminderAt: new Date("2019-08-24T14:15:22Z"), + adsConsentSetAt: new Date("2019-08-24T14:15:22Z"), + anonymous: false, + authToken: "CxoUzBTSV5hsxjTpFKaf", + backupCodesCreated: false, + confirmed: false, + country: "US", + email: "username@email.com", + emailOnlyAuth: false, + experimentalFeatures: false, + friendlyName: "friendlyUsername", + entitlements: ["[]"], + guest: false, + hasPassword: true, + home: false, + homeAdmin: false, + homeSize: 1, + id: 13692262, + joinedAt: 1721154902, + locale: null, + mailingListActive: false, + mailingListStatus: PostUsersSigninDataMailingListStatus.Subscribed, + maxHomeSize: 15, + pin: "string", + profile: [ + { + autoSelectAudio: true, + defaultAudioLanguage: "ja", + defaultSubtitleLanguage: "en", + autoSelectSubtitle: 1, + defaultSubtitleAccessibility: 1, + defaultSubtitleForced: 0, + watchedIndicator: 1, + mediaReviewsVisibility: 0, + }, + ], + protected: false, + rememberExpiresAt: 1722364046, + restricted: false, + roles: ["string"], + scrobbleTypes: "", + services: [ + { + identifier: "metadata-dev", + endpoint: "https://epg.provider.plex.tv", + token: "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", + secret: "string", + status: PostUsersSigninDataStatus.Online, + }, + ], + subscription: { + features: [PostUsersSigninDataFeatures.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: PostUsersSigninDataUserStatus.Inactive, + paymentService: "string", + plan: "string", + }, + subscriptionDescription: "string", + subscriptions: [ + { + features: [PostUsersSigninDataUserFeatures.AndroidDolbyVision], + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: PostUsersSigninDataUserResponseStatus.Inactive, + paymentService: "string", + plan: "string", + }, + ], + thumb: "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", + title: "UsernameTitle", + twoFactorEnabled: false, + username: "Username", + uuid: "dae343c1f45beb4f", + pastSubscriptions: [ + { + id: "string", + mode: "string", + renewsAt: string, + endsAt: 1556281940, + canceled: true, + gracePeriod: true, + onHold: true, + canReactivate: true, + canUpgrade: true, + canDowngrade: true, + canConvert: true, + type: "plexpass", + transfer: "string", + state: PostUsersSigninDataState.Ended, + billing: [ + { + internalPaymentMethod: {}, + paymentMethodId: string, + }, + ], + }, + ], + trials: [{}], +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `adsConsent` | *boolean* | :heavy_check_mark: | Unknown | | +| `adsConsentReminderAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Unknown | | +| `adsConsentSetAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Unknown | | +| `anonymous` | *boolean* | :heavy_minus_sign: | Unknown | | +| `authToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf | +| `backupCodesCreated` | *boolean* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | | +| `confirmed` | *boolean* | :heavy_minus_sign: | If the account has been confirmed | | +| `country` | *string* | :heavy_check_mark: | The account country | US | +| `email` | *string* | :heavy_check_mark: | The account email address | username@email.com | +| `emailOnlyAuth` | *boolean* | :heavy_minus_sign: | If login with email only is enabled | | +| `experimentalFeatures` | *boolean* | :heavy_minus_sign: | If experimental features are enabled | | +| `friendlyName` | *string* | :heavy_check_mark: | Your account full name | friendlyUsername | +| `entitlements` | *string*[] | :heavy_check_mark: | List of devices your allowed to use with this account | | +| `guest` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home guest user | | +| `hasPassword` | *boolean* | :heavy_minus_sign: | If the account has a password | | +| `home` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home user | | +| `homeAdmin` | *boolean* | :heavy_minus_sign: | If the account is the Plex Home admin | | +| `homeSize` | *number* | :heavy_check_mark: | The number of accounts in the Plex Home | 1 | +| `id` | *number* | :heavy_check_mark: | The Plex account ID | 13692262 | +| `joinedAt` | *number* | :heavy_check_mark: | Unix epoch datetime the account joined Plex | 1721154902 | +| `locale` | *string* | :heavy_check_mark: | The account locale | | +| `mailingListActive` | *boolean* | :heavy_minus_sign: | If you are subscribed to the Plex newsletter | | +| `mailingListStatus` | [models.PostUsersSigninDataMailingListStatus](../models/postuserssignindatamailingliststatus.md) | :heavy_check_mark: | Your current mailing list status | | +| `maxHomeSize` | *number* | :heavy_check_mark: | The maximum number of accounts allowed in the Plex Home | 15 | +| ~~`pin`~~ | *string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

[Might be removed] The hashed Plex Home PIN | | +| `profile` | [models.PostUsersSigninDataUserProfile](../models/postuserssignindatauserprofile.md)[] | :heavy_check_mark: | N/A | | +| `protected` | *boolean* | :heavy_minus_sign: | If the account has a Plex Home PIN enabled | | +| `rememberExpiresAt` | *number* | :heavy_check_mark: | Unix epoch datetime the authtoken expires | 1722364046 | +| `restricted` | *boolean* | :heavy_minus_sign: | If the account is a Plex Home managed user | | +| `roles` | *string*[] | :heavy_minus_sign: | [Might be removed] List of account roles. Plexpass membership listed here | | +| `scrobbleTypes` | *string* | :heavy_check_mark: | Unknown | | +| `services` | [models.PostUsersSigninDataServices](../models/postuserssignindataservices.md)[] | :heavy_check_mark: | N/A | | +| `subscription` | [models.PostUsersSigninDataSubscription](../models/postuserssignindatasubscription.md) | :heavy_check_mark: | If the account’s Plex Pass subscription is active | | +| `subscriptionDescription` | *string* | :heavy_check_mark: | Description of the Plex Pass subscription | | +| `subscriptions` | [models.PostUsersSigninDataUserSubscription](../models/postuserssignindatausersubscription.md)[] | :heavy_check_mark: | N/A | | +| `thumb` | *string* | :heavy_check_mark: | URL of the account thumbnail | https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101 | +| `title` | *string* | :heavy_check_mark: | The title of the account (username or friendly name) | UsernameTitle | +| `twoFactorEnabled` | *boolean* | :heavy_minus_sign: | If two-factor authentication is enabled | | +| `username` | *string* | :heavy_check_mark: | The account username | Username | +| `uuid` | *string* | :heavy_check_mark: | The account UUID | dae343c1f45beb4f | +| `pastSubscriptions` | [models.PastSubscription](../models/pastsubscription.md)[] | :heavy_check_mark: | N/A | | +| `trials` | [models.Trials](../models/trials.md)[] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/postuserssignindatauserprofile.md b/docs/models/postuserssignindatauserprofile.md new file mode 100644 index 00000000..43f2e212 --- /dev/null +++ b/docs/models/postuserssignindatauserprofile.md @@ -0,0 +1,31 @@ +# PostUsersSigninDataUserProfile + +## Example Usage + +```typescript +import { PostUsersSigninDataUserProfile } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataUserProfile = { + autoSelectAudio: true, + defaultAudioLanguage: "ja", + defaultSubtitleLanguage: "en", + autoSelectSubtitle: 1, + defaultSubtitleAccessibility: 1, + defaultSubtitleForced: 0, + watchedIndicator: 1, + mediaReviewsVisibility: 0, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `autoSelectAudio` | *boolean* | :heavy_minus_sign: | If the account has automatically select audio and subtitle tracks enabled | true | +| `defaultAudioLanguage` | *string* | :heavy_minus_sign: | The preferred audio language for the account | ja | +| `defaultSubtitleLanguage` | *string* | :heavy_minus_sign: | The preferred subtitle language for the account | en | +| `autoSelectSubtitle` | *number* | :heavy_minus_sign: | The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) | 1 | +| `defaultSubtitleAccessibility` | *number* | :heavy_minus_sign: | The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) | 1 | +| `defaultSubtitleForced` | *number* | :heavy_minus_sign: | The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) | 0 | +| `watchedIndicator` | *number* | :heavy_minus_sign: | N/A | 1 | +| `mediaReviewsVisibility` | *number* | :heavy_minus_sign: | N/A | 0 | \ No newline at end of file diff --git a/docs/models/postuserssignindatauserresponsestatus.md b/docs/models/postuserssignindatauserresponsestatus.md new file mode 100644 index 00000000..3a75e381 --- /dev/null +++ b/docs/models/postuserssignindatauserresponsestatus.md @@ -0,0 +1,18 @@ +# PostUsersSigninDataUserResponseStatus + +String representation of subscriptionActive + +## Example Usage + +```typescript +import { PostUsersSigninDataUserResponseStatus } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataUserResponseStatus = PostUsersSigninDataUserResponseStatus.Inactive; +``` + +## Values + +| Name | Value | +| ---------- | ---------- | +| `Inactive` | Inactive | +| `Active` | Active | \ No newline at end of file diff --git a/docs/models/postuserssignindatauserstatus.md b/docs/models/postuserssignindatauserstatus.md new file mode 100644 index 00000000..71a5b130 --- /dev/null +++ b/docs/models/postuserssignindatauserstatus.md @@ -0,0 +1,18 @@ +# PostUsersSigninDataUserStatus + +String representation of subscriptionActive + +## Example Usage + +```typescript +import { PostUsersSigninDataUserStatus } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataUserStatus = PostUsersSigninDataUserStatus.Inactive; +``` + +## Values + +| Name | Value | +| ---------- | ---------- | +| `Inactive` | Inactive | +| `Active` | Active | \ No newline at end of file diff --git a/docs/models/postuserssignindatausersubscription.md b/docs/models/postuserssignindatausersubscription.md new file mode 100644 index 00000000..dcc3cc00 --- /dev/null +++ b/docs/models/postuserssignindatausersubscription.md @@ -0,0 +1,24 @@ +# PostUsersSigninDataUserSubscription + +## Example Usage + +```typescript +import { PostUsersSigninDataUserResponseStatus, PostUsersSigninDataUserSubscription } from "@lukehagar/plexjs"; + +let value: PostUsersSigninDataUserSubscription = { + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: PostUsersSigninDataUserResponseStatus.Inactive, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `features` | [models.PostUsersSigninDataUserFeatures](../models/postuserssignindatauserfeatures.md)[] | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `active` | *boolean* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `subscribedAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `status` | [models.PostUsersSigninDataUserResponseStatus](../models/postuserssignindatauserresponsestatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `paymentService` | *string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `plan` | *string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/producer.md b/docs/models/producer.md index 1c6660d1..1f9c2d9e 100644 --- a/docs/models/producer.md +++ b/docs/models/producer.md @@ -1,5 +1,18 @@ # Producer +## Example Usage + +```typescript +import { Producer } from "@lukehagar/plexjs"; + +let value: Producer = { + id: 221, + filter: "producer=221", + tag: "Barry Mendel", + tagKey: "5d776826961905001eb90e2b", + thumb: "https://metadata-static.plex.tv/8/people/87877371326a964634d18556d94547e1.jpg", +}; +``` ## Fields diff --git a/docs/models/provider.md b/docs/models/provider.md index 560e33ad..e64487d7 100644 --- a/docs/models/provider.md +++ b/docs/models/provider.md @@ -1,5 +1,16 @@ # Provider +## Example Usage + +```typescript +import { Provider } from "@lukehagar/plexjs"; + +let value: Provider = { + key: "/system/search", + title: "Local Network", + type: "mixed", +}; +``` ## Fields diff --git a/docs/models/queryparamonlytransient.md b/docs/models/queryparamonlytransient.md index 6ae6613e..81986153 100644 --- a/docs/models/queryparamonlytransient.md +++ b/docs/models/queryparamonlytransient.md @@ -2,6 +2,13 @@ Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). +## Example Usage + +```typescript +import { QueryParamOnlyTransient } from "@lukehagar/plexjs"; + +let value: QueryParamOnlyTransient = QueryParamOnlyTransient.One; +``` ## Values diff --git a/docs/models/queryparamsmart.md b/docs/models/queryparamsmart.md index 00f49fb1..dacbf57e 100644 --- a/docs/models/queryparamsmart.md +++ b/docs/models/queryparamsmart.md @@ -2,6 +2,13 @@ type of playlists to return (default is all). +## Example Usage + +```typescript +import { QueryParamSmart } from "@lukehagar/plexjs"; + +let value: QueryParamSmart = QueryParamSmart.Zero; +``` ## Values diff --git a/docs/models/queryparamtype.md b/docs/models/queryparamtype.md index 549a0c1d..2ab8320d 100644 --- a/docs/models/queryparamtype.md +++ b/docs/models/queryparamtype.md @@ -2,6 +2,13 @@ type of playlist to create +## Example Usage + +```typescript +import { QueryParamType } from "@lukehagar/plexjs"; + +let value: QueryParamType = QueryParamType.Audio; +``` ## Values diff --git a/docs/models/ratings.md b/docs/models/ratings.md index beb47938..6d28396f 100644 --- a/docs/models/ratings.md +++ b/docs/models/ratings.md @@ -1,5 +1,16 @@ # Ratings +## Example Usage + +```typescript +import { Ratings } from "@lukehagar/plexjs"; + +let value: Ratings = { + image: "themoviedb://image.rating", + value: 7.4, + type: "audience", +}; +``` ## Fields diff --git a/docs/models/refreshlibraryerrors.md b/docs/models/refreshlibraryerrors.md index 8d22faed..f1b9f83e 100644 --- a/docs/models/refreshlibraryerrors.md +++ b/docs/models/refreshlibraryerrors.md @@ -1,5 +1,16 @@ # RefreshLibraryErrors +## Example Usage + +```typescript +import { RefreshLibraryErrors } from "@lukehagar/plexjs"; + +let value: RefreshLibraryErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/refreshlibraryrequest.md b/docs/models/refreshlibraryrequest.md index a4665ae3..20750fa7 100644 --- a/docs/models/refreshlibraryrequest.md +++ b/docs/models/refreshlibraryrequest.md @@ -1,5 +1,14 @@ # RefreshLibraryRequest +## Example Usage + +```typescript +import { RefreshLibraryRequest } from "@lukehagar/plexjs"; + +let value: RefreshLibraryRequest = { + sectionId: 187.89, +}; +``` ## Fields diff --git a/docs/models/refreshlibraryresponse.md b/docs/models/refreshlibraryresponse.md index 0cd5210b..cddba6af 100644 --- a/docs/models/refreshlibraryresponse.md +++ b/docs/models/refreshlibraryresponse.md @@ -1,5 +1,18 @@ # RefreshLibraryResponse +## Example Usage + +```typescript +import { RefreshLibraryResponse } from "@lukehagar/plexjs"; + +let value: RefreshLibraryResponse = { + contentType: "", + statusCode: 324141, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/refreshlibraryresponsebody.md b/docs/models/refreshlibraryresponsebody.md index 1a7d99f0..280e5ae0 100644 --- a/docs/models/refreshlibraryresponsebody.md +++ b/docs/models/refreshlibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { RefreshLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/release.md b/docs/models/release.md index d5f2cd9a..ace1dcdf 100644 --- a/docs/models/release.md +++ b/docs/models/release.md @@ -1,5 +1,34 @@ # Release +## Example Usage + +```typescript +import { Release } from "@lukehagar/plexjs"; + +let value: Release = { + key: "https://plex.tv/updater/releases/5136", + version: "1.40.0.7775-456fbaf97", + added: "(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish. +(Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793) +(Music) Store track genres and add filtering options (#14653) +(Music) Support ID3v2.4 null-separated tags for genres and release type (#14653) +(View History) No longer create a view history entry for items marked as played (#10888) +(Web) Updated to 4.118.0", + fixed: "(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483) +(Agents) It is possible that agents are not initialised during startup on rare occasions (#14654) +(Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667) +(Collection) Server could become unresponsive when collection membership changes (#14612) +(DVR) Previously watched recordings could be deleted without being watched again (#13779) +(Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501) +(Library) The Content Rating not equal to None filter does not work (#14620) +(Search) Album search results could contain all the album's tracks too (#14486) +(Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674) +(Transcoder) HW encoding would fail on devices with no rate control (#14222) +(Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)", + downloadURL: "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", + state: "notify", +}; +``` ## Fields diff --git a/docs/models/responsebody.md b/docs/models/responsebody.md new file mode 100644 index 00000000..c2651217 --- /dev/null +++ b/docs/models/responsebody.md @@ -0,0 +1,27 @@ +# ResponseBody + +## Example Usage + +```typescript +import { ResponseBody } from "@lukehagar/plexjs"; + +let value: ResponseBody = { + identifier: "tv.plex.sonos", + baseURL: "https://sonos.plex.tv", + title: "Sonos", + linkURL: "https://sonos.plex.tv/link", + provides: "client,player", + token: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `identifier` | *string* | :heavy_check_mark: | N/A | tv.plex.sonos | +| `baseURL` | *string* | :heavy_check_mark: | N/A | https://sonos.plex.tv | +| `title` | *string* | :heavy_check_mark: | N/A | Sonos | +| `linkURL` | *string* | :heavy_check_mark: | N/A | https://sonos.plex.tv/link | +| `provides` | *string* | :heavy_check_mark: | N/A | client,player | +| `token` | *string* | :heavy_check_mark: | The plex authtoken used to identify with | | \ No newline at end of file diff --git a/docs/models/role.md b/docs/models/role.md index bdbf71fe..bc84a37b 100644 --- a/docs/models/role.md +++ b/docs/models/role.md @@ -1,5 +1,14 @@ # Role +## Example Usage + +```typescript +import { Role } from "@lukehagar/plexjs"; + +let value: Role = { + tag: "Paul Rudd", +}; +``` ## Fields diff --git a/docs/models/scope.md b/docs/models/scope.md index ac7b0f18..9fd3669e 100644 --- a/docs/models/scope.md +++ b/docs/models/scope.md @@ -2,6 +2,13 @@ `all` - This is the only supported `scope` parameter. +## Example Usage + +```typescript +import { Scope } from "@lukehagar/plexjs"; + +let value: Scope = Scope.All; +``` ## Values diff --git a/docs/models/searchlibraryerrors.md b/docs/models/searchlibraryerrors.md index fb1f1259..d32c3c75 100644 --- a/docs/models/searchlibraryerrors.md +++ b/docs/models/searchlibraryerrors.md @@ -1,5 +1,16 @@ # SearchLibraryErrors +## Example Usage + +```typescript +import { SearchLibraryErrors } from "@lukehagar/plexjs"; + +let value: SearchLibraryErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/searchlibrarylibraryresponsebody.md b/docs/models/searchlibrarylibraryresponsebody.md index 8d394c82..fd4b2a40 100644 --- a/docs/models/searchlibrarylibraryresponsebody.md +++ b/docs/models/searchlibrarylibraryresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { SearchLibraryLibraryResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/searchlibrarymediacontainer.md b/docs/models/searchlibrarymediacontainer.md index 093927f9..a65c8eaf 100644 --- a/docs/models/searchlibrarymediacontainer.md +++ b/docs/models/searchlibrarymediacontainer.md @@ -1,5 +1,50 @@ # SearchLibraryMediaContainer +## Example Usage + +```typescript +import { SearchLibraryMediaContainer } from "@lukehagar/plexjs"; + +let value: SearchLibraryMediaContainer = { + size: 2, + allowSync: false, + art: "/:/resources/show-fanart.jpg", + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + nocache: true, + thumb: "/:/resources/show.png", + title1: "TV Shows", + title2: "Search for ''", + viewGroup: "season", + viewMode: 65593, + metadata: [ + { + ratingKey: "2", + key: "/library/metadata/2/children", + parentRatingKey: "1", + guid: "plex://season/602e67e766dfdb002c0a1b5b", + parentGuid: "plex://show/5d9c086c7d06d9001ffd27aa", + parentStudio: "Mutant Enemy Productions", + type: "season", + title: "Season 1", + parentKey: "/library/metadata/1", + parentTitle: "Firefly", + summary: + "Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is the captain of the transport ship \"Serenity\". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government \"The Alliance\"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space.", + index: 1, + parentIndex: 1, + parentYear: 2002, + thumb: "/library/metadata/2/thumb/1705636920", + art: "/library/metadata/1/art/1705636920", + parentThumb: "/library/metadata/1/thumb/1705636920", + parentTheme: "/library/metadata/1/theme/1705636920", + addedAt: 1705636916, + updatedAt: 1705636920, + }, + ], +}; +``` ## Fields diff --git a/docs/models/searchlibrarymetadata.md b/docs/models/searchlibrarymetadata.md index ee42b14d..3cda2137 100644 --- a/docs/models/searchlibrarymetadata.md +++ b/docs/models/searchlibrarymetadata.md @@ -1,5 +1,34 @@ # SearchLibraryMetadata +## Example Usage + +```typescript +import { SearchLibraryMetadata } from "@lukehagar/plexjs"; + +let value: SearchLibraryMetadata = { + ratingKey: "2", + key: "/library/metadata/2/children", + parentRatingKey: "1", + guid: "plex://season/602e67e766dfdb002c0a1b5b", + parentGuid: "plex://show/5d9c086c7d06d9001ffd27aa", + parentStudio: "Mutant Enemy Productions", + type: "season", + title: "Season 1", + parentKey: "/library/metadata/1", + parentTitle: "Firefly", + summary: + "Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is the captain of the transport ship \"Serenity\". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government \"The Alliance\"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space.", + index: 1, + parentIndex: 1, + parentYear: 2002, + thumb: "/library/metadata/2/thumb/1705636920", + art: "/library/metadata/1/art/1705636920", + parentThumb: "/library/metadata/1/thumb/1705636920", + parentTheme: "/library/metadata/1/theme/1705636920", + addedAt: 1705636916, + updatedAt: 1705636920, +}; +``` ## Fields diff --git a/docs/models/searchlibraryrequest.md b/docs/models/searchlibraryrequest.md index 224d2487..3cfe4d73 100644 --- a/docs/models/searchlibraryrequest.md +++ b/docs/models/searchlibraryrequest.md @@ -1,5 +1,15 @@ # SearchLibraryRequest +## Example Usage + +```typescript +import { SearchLibraryRequest, Type } from "@lukehagar/plexjs"; + +let value: SearchLibraryRequest = { + sectionId: 149675, + type: Type.Three, +}; +``` ## Fields diff --git a/docs/models/searchlibraryresponse.md b/docs/models/searchlibraryresponse.md index 2ee882b5..f95e7462 100644 --- a/docs/models/searchlibraryresponse.md +++ b/docs/models/searchlibraryresponse.md @@ -1,5 +1,59 @@ # SearchLibraryResponse +## Example Usage + +```typescript +import { SearchLibraryResponse } from "@lukehagar/plexjs"; + +let value: SearchLibraryResponse = { + contentType: "", + statusCode: 222321, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), + object: { + mediaContainer: { + size: 2, + allowSync: false, + art: "/:/resources/show-fanart.jpg", + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + nocache: true, + thumb: "/:/resources/show.png", + title1: "TV Shows", + title2: "Search for ''", + viewGroup: "season", + viewMode: 65593, + metadata: [ + { + ratingKey: "2", + key: "/library/metadata/2/children", + parentRatingKey: "1", + guid: "plex://season/602e67e766dfdb002c0a1b5b", + parentGuid: "plex://show/5d9c086c7d06d9001ffd27aa", + parentStudio: "Mutant Enemy Productions", + type: "season", + title: "Season 1", + parentKey: "/library/metadata/1", + parentTitle: "Firefly", + summary: + "Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is the captain of the transport ship \"Serenity\". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government \"The Alliance\"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space.", + index: 1, + parentIndex: 1, + parentYear: 2002, + thumb: "/library/metadata/2/thumb/1705636920", + art: "/library/metadata/1/art/1705636920", + parentThumb: "/library/metadata/1/thumb/1705636920", + parentTheme: "/library/metadata/1/theme/1705636920", + addedAt: 1705636916, + updatedAt: 1705636920, + }, + ], + }, + }, +}; +``` ## Fields diff --git a/docs/models/searchlibraryresponsebody.md b/docs/models/searchlibraryresponsebody.md index 7d86c147..31232e79 100644 --- a/docs/models/searchlibraryresponsebody.md +++ b/docs/models/searchlibraryresponsebody.md @@ -2,6 +2,53 @@ The contents of the library by section and type +## Example Usage + +```typescript +import { SearchLibraryResponseBody } from "@lukehagar/plexjs"; + +let value: SearchLibraryResponseBody = { + mediaContainer: { + size: 2, + allowSync: false, + art: "/:/resources/show-fanart.jpg", + identifier: "com.plexapp.plugins.library", + mediaTagPrefix: "/system/bundle/media/flags/", + mediaTagVersion: 1698860922, + nocache: true, + thumb: "/:/resources/show.png", + title1: "TV Shows", + title2: "Search for ''", + viewGroup: "season", + viewMode: 65593, + metadata: [ + { + ratingKey: "2", + key: "/library/metadata/2/children", + parentRatingKey: "1", + guid: "plex://season/602e67e766dfdb002c0a1b5b", + parentGuid: "plex://show/5d9c086c7d06d9001ffd27aa", + parentStudio: "Mutant Enemy Productions", + type: "season", + title: "Season 1", + parentKey: "/library/metadata/1", + parentTitle: "Firefly", + summary: + "Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is the captain of the transport ship \"Serenity\". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government \"The Alliance\"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space.", + index: 1, + parentIndex: 1, + parentYear: 2002, + thumb: "/library/metadata/2/thumb/1705636920", + art: "/library/metadata/1/art/1705636920", + parentThumb: "/library/metadata/1/thumb/1705636920", + parentTheme: "/library/metadata/1/theme/1705636920", + addedAt: 1705636916, + updatedAt: 1705636920, + }, + ], + }, +}; +``` ## Fields diff --git a/docs/models/security.md b/docs/models/security.md index 72dd5416..9497a244 100644 --- a/docs/models/security.md +++ b/docs/models/security.md @@ -1,8 +1,15 @@ # Security +## Example Usage + +```typescript +import { Security } from "@lukehagar/plexjs"; + +let value: Security = {}; +``` ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `accessToken` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| `accessToken` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/services.md b/docs/models/services.md new file mode 100644 index 00000000..c3dfd69d --- /dev/null +++ b/docs/models/services.md @@ -0,0 +1,25 @@ +# Services + +## Example Usage + +```typescript +import { GetUserDetailsStatus, Services } from "@lukehagar/plexjs"; + +let value: Services = { + identifier: "metadata-dev", + endpoint: "https://epg.provider.plex.tv", + token: "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", + secret: "", + status: GetUserDetailsStatus.Online, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `identifier` | *string* | :heavy_check_mark: | N/A | metadata-dev | +| `endpoint` | *string* | :heavy_check_mark: | N/A | https://epg.provider.plex.tv | +| `token` | *string* | :heavy_check_mark: | N/A | DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv | +| `secret` | *string* | :heavy_check_mark: | N/A | | +| `status` | [models.GetUserDetailsStatus](../models/getuserdetailsstatus.md) | :heavy_check_mark: | N/A | online | \ No newline at end of file diff --git a/docs/models/session.md b/docs/models/session.md index c6f87d84..3008e881 100644 --- a/docs/models/session.md +++ b/docs/models/session.md @@ -1,5 +1,16 @@ # Session +## Example Usage + +```typescript +import { Session } from "@lukehagar/plexjs"; + +let value: Session = { + id: "93h7e00ncblxncqw9lkfaoxi", + bandwidth: 1050, + location: "lan", +}; +``` ## Fields diff --git a/docs/models/setting.md b/docs/models/setting.md index 6cfdd264..542ce884 100644 --- a/docs/models/setting.md +++ b/docs/models/setting.md @@ -1,5 +1,23 @@ # Setting +## Example Usage + +```typescript +import { Setting } from "@lukehagar/plexjs"; + +let value: Setting = { + id: "EnableDatabaseTrace", + label: "", + summary: "", + type: "bool", + default: false, + value: false, + hidden: true, + advanced: false, + group: "", + enumValues: "1:admin only|2:everyone", +}; +``` ## Fields diff --git a/docs/models/sharedservers.md b/docs/models/sharedservers.md new file mode 100644 index 00000000..cc205929 --- /dev/null +++ b/docs/models/sharedservers.md @@ -0,0 +1,14 @@ +# SharedServers + +## Example Usage + +```typescript +import { SharedServers } from "@lukehagar/plexjs"; + +let value: SharedServers = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/sharedsources.md b/docs/models/sharedsources.md new file mode 100644 index 00000000..b3c1f1c3 --- /dev/null +++ b/docs/models/sharedsources.md @@ -0,0 +1,14 @@ +# SharedSources + +## Example Usage + +```typescript +import { SharedSources } from "@lukehagar/plexjs"; + +let value: SharedSources = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/skip.md b/docs/models/skip.md index bdc10b9e..619b8a2c 100644 --- a/docs/models/skip.md +++ b/docs/models/skip.md @@ -2,6 +2,13 @@ Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. +## Example Usage + +```typescript +import { Skip } from "@lukehagar/plexjs"; + +let value: Skip = Skip.One; +``` ## Values diff --git a/docs/models/smart.md b/docs/models/smart.md index 9be17988..6918a510 100644 --- a/docs/models/smart.md +++ b/docs/models/smart.md @@ -2,6 +2,13 @@ whether the playlist is smart or not +## Example Usage + +```typescript +import { Smart } from "@lukehagar/plexjs"; + +let value: Smart = Smart.One; +``` ## Values diff --git a/docs/models/sort.md b/docs/models/sort.md index 64ea715b..49515ca7 100644 --- a/docs/models/sort.md +++ b/docs/models/sort.md @@ -1,5 +1,19 @@ # Sort +## Example Usage + +```typescript +import { Sort } from "@lukehagar/plexjs"; + +let value: Sort = { + default: "asc", + defaultDirection: "desc", + descKey: "random:desc", + firstCharacterKey: "/library/sections/1/firstCharacter", + key: "random", + title: "Randomly", +}; +``` ## Fields diff --git a/docs/models/startalltaskserrors.md b/docs/models/startalltaskserrors.md index d08347c6..b376e491 100644 --- a/docs/models/startalltaskserrors.md +++ b/docs/models/startalltaskserrors.md @@ -1,5 +1,16 @@ # StartAllTasksErrors +## Example Usage + +```typescript +import { StartAllTasksErrors } from "@lukehagar/plexjs"; + +let value: StartAllTasksErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/startalltasksresponse.md b/docs/models/startalltasksresponse.md index eda57272..d1defcaa 100644 --- a/docs/models/startalltasksresponse.md +++ b/docs/models/startalltasksresponse.md @@ -1,5 +1,18 @@ # StartAllTasksResponse +## Example Usage + +```typescript +import { StartAllTasksResponse } from "@lukehagar/plexjs"; + +let value: StartAllTasksResponse = { + contentType: "", + statusCode: 812169, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/startalltasksresponsebody.md b/docs/models/startalltasksresponsebody.md index cca04358..14566b53 100644 --- a/docs/models/startalltasksresponsebody.md +++ b/docs/models/startalltasksresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { StartAllTasksResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/starttaskerrors.md b/docs/models/starttaskerrors.md index 4a7da6fa..80866117 100644 --- a/docs/models/starttaskerrors.md +++ b/docs/models/starttaskerrors.md @@ -1,5 +1,16 @@ # StartTaskErrors +## Example Usage + +```typescript +import { StartTaskErrors } from "@lukehagar/plexjs"; + +let value: StartTaskErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/starttaskrequest.md b/docs/models/starttaskrequest.md index 061ca9f8..b8942bec 100644 --- a/docs/models/starttaskrequest.md +++ b/docs/models/starttaskrequest.md @@ -1,5 +1,14 @@ # StartTaskRequest +## Example Usage + +```typescript +import { StartTaskRequest, TaskName } from "@lukehagar/plexjs"; + +let value: StartTaskRequest = { + taskName: TaskName.GenerateChapterThumbs, +}; +``` ## Fields diff --git a/docs/models/starttaskresponse.md b/docs/models/starttaskresponse.md index d148bb3d..f0ad6cd8 100644 --- a/docs/models/starttaskresponse.md +++ b/docs/models/starttaskresponse.md @@ -1,5 +1,18 @@ # StartTaskResponse +## Example Usage + +```typescript +import { StartTaskResponse } from "@lukehagar/plexjs"; + +let value: StartTaskResponse = { + contentType: "", + statusCode: 392785, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/starttaskresponsebody.md b/docs/models/starttaskresponsebody.md index 19b9cf2f..ea551725 100644 --- a/docs/models/starttaskresponsebody.md +++ b/docs/models/starttaskresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { StartTaskResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/startuniversaltranscodeerrors.md b/docs/models/startuniversaltranscodeerrors.md index 84f7ff7c..7992221c 100644 --- a/docs/models/startuniversaltranscodeerrors.md +++ b/docs/models/startuniversaltranscodeerrors.md @@ -1,5 +1,16 @@ # StartUniversalTranscodeErrors +## Example Usage + +```typescript +import { StartUniversalTranscodeErrors } from "@lukehagar/plexjs"; + +let value: StartUniversalTranscodeErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/startuniversaltranscoderequest.md b/docs/models/startuniversaltranscoderequest.md index 702391df..68d5cae4 100644 --- a/docs/models/startuniversaltranscoderequest.md +++ b/docs/models/startuniversaltranscoderequest.md @@ -1,5 +1,29 @@ # StartUniversalTranscodeRequest +## Example Usage + +```typescript +import { StartUniversalTranscodeRequest } from "@lukehagar/plexjs"; + +let value: StartUniversalTranscodeRequest = { + hasMDE: 1, + path: "/library/metadata/23409", + mediaIndex: 0, + partIndex: 0, + protocol: "hls", + fastSeek: 0, + directPlay: 0, + directStream: 0, + subtitleSize: 100, + subtites: "burn", + audioBoost: 100, + location: "lan", + mediaBufferSize: 102400, + session: "zvcage8b7rkioqcm8f4uns4c", + addDebugOverlay: 0, + autoAdjustQuality: 0, +}; +``` ## Fields diff --git a/docs/models/startuniversaltranscoderesponse.md b/docs/models/startuniversaltranscoderesponse.md index 3c61ba22..b79c987e 100644 --- a/docs/models/startuniversaltranscoderesponse.md +++ b/docs/models/startuniversaltranscoderesponse.md @@ -1,5 +1,18 @@ # StartUniversalTranscodeResponse +## Example Usage + +```typescript +import { StartUniversalTranscodeResponse } from "@lukehagar/plexjs"; + +let value: StartUniversalTranscodeResponse = { + contentType: "", + statusCode: 272656, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/startuniversaltranscoderesponsebody.md b/docs/models/startuniversaltranscoderesponsebody.md index f92a9069..4ed22e4a 100644 --- a/docs/models/startuniversaltranscoderesponsebody.md +++ b/docs/models/startuniversaltranscoderesponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { StartUniversalTranscodeResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/state.md b/docs/models/state.md index 52d6ca44..7a19c883 100644 --- a/docs/models/state.md +++ b/docs/models/state.md @@ -2,6 +2,13 @@ The state of the media item +## Example Usage + +```typescript +import { State } from "@lukehagar/plexjs"; + +let value: State = State.Playing; +``` ## Values diff --git a/docs/models/statisticsbandwidth.md b/docs/models/statisticsbandwidth.md index 7ac2060a..698e6514 100644 --- a/docs/models/statisticsbandwidth.md +++ b/docs/models/statisticsbandwidth.md @@ -1,5 +1,18 @@ # StatisticsBandwidth +## Example Usage + +```typescript +import { StatisticsBandwidth } from "@lukehagar/plexjs"; + +let value: StatisticsBandwidth = { + accountID: 238960586, + timespan: 6, + at: 1718387650, + lan: true, + bytes: 22, +}; +``` ## Fields diff --git a/docs/models/statisticsmedia.md b/docs/models/statisticsmedia.md index 9bae48e7..32f26f02 100644 --- a/docs/models/statisticsmedia.md +++ b/docs/models/statisticsmedia.md @@ -1,5 +1,20 @@ # StatisticsMedia +## Example Usage + +```typescript +import { StatisticsMedia } from "@lukehagar/plexjs"; + +let value: StatisticsMedia = { + accountID: 1, + deviceID: 13, + timespan: 4, + at: 1707141600, + metadataType: 4, + count: 1, + duration: 1555, +}; +``` ## Fields diff --git a/docs/models/statisticsresources.md b/docs/models/statisticsresources.md index b37117b8..f4c792a9 100644 --- a/docs/models/statisticsresources.md +++ b/docs/models/statisticsresources.md @@ -1,5 +1,19 @@ # StatisticsResources +## Example Usage + +```typescript +import { StatisticsResources } from "@lukehagar/plexjs"; + +let value: StatisticsResources = { + timespan: 6, + at: 1718384427, + hostCpuUtilization: 1.276, + processCpuUtilization: 0.025, + hostMemoryUtilization: 17.026, + processMemoryUtilization: 0.493, +}; +``` ## Fields diff --git a/docs/models/status.md b/docs/models/status.md new file mode 100644 index 00000000..613142b2 --- /dev/null +++ b/docs/models/status.md @@ -0,0 +1,17 @@ +# Status + +Current friend request status + +## Example Usage + +```typescript +import { Status } from "@lukehagar/plexjs"; + +let value: Status = Status.Accepted; +``` + +## Values + +| Name | Value | +| ---------- | ---------- | +| `Accepted` | accepted | \ No newline at end of file diff --git a/docs/models/stopalltaskserrors.md b/docs/models/stopalltaskserrors.md index 7fc89f50..101cc73f 100644 --- a/docs/models/stopalltaskserrors.md +++ b/docs/models/stopalltaskserrors.md @@ -1,5 +1,16 @@ # StopAllTasksErrors +## Example Usage + +```typescript +import { StopAllTasksErrors } from "@lukehagar/plexjs"; + +let value: StopAllTasksErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/stopalltasksresponse.md b/docs/models/stopalltasksresponse.md index 892d67b3..41ac0c51 100644 --- a/docs/models/stopalltasksresponse.md +++ b/docs/models/stopalltasksresponse.md @@ -1,5 +1,18 @@ # StopAllTasksResponse +## Example Usage + +```typescript +import { StopAllTasksResponse } from "@lukehagar/plexjs"; + +let value: StopAllTasksResponse = { + contentType: "", + statusCode: 528895, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/stopalltasksresponsebody.md b/docs/models/stopalltasksresponsebody.md index 7756ddc6..fba760c0 100644 --- a/docs/models/stopalltasksresponsebody.md +++ b/docs/models/stopalltasksresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { StopAllTasksResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/stoptaskerrors.md b/docs/models/stoptaskerrors.md index dc4cf4c1..a340f54b 100644 --- a/docs/models/stoptaskerrors.md +++ b/docs/models/stoptaskerrors.md @@ -1,5 +1,16 @@ # StopTaskErrors +## Example Usage + +```typescript +import { StopTaskErrors } from "@lukehagar/plexjs"; + +let value: StopTaskErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/stoptaskrequest.md b/docs/models/stoptaskrequest.md index c1a97e0d..b618f4eb 100644 --- a/docs/models/stoptaskrequest.md +++ b/docs/models/stoptaskrequest.md @@ -1,5 +1,14 @@ # StopTaskRequest +## Example Usage + +```typescript +import { PathParamTaskName, StopTaskRequest } from "@lukehagar/plexjs"; + +let value: StopTaskRequest = { + taskName: PathParamTaskName.RefreshLocalMedia, +}; +``` ## Fields diff --git a/docs/models/stoptaskresponse.md b/docs/models/stoptaskresponse.md index 39c15d9f..505a80b1 100644 --- a/docs/models/stoptaskresponse.md +++ b/docs/models/stoptaskresponse.md @@ -1,5 +1,18 @@ # StopTaskResponse +## Example Usage + +```typescript +import { StopTaskResponse } from "@lukehagar/plexjs"; + +let value: StopTaskResponse = { + contentType: "", + statusCode: 71036, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/stoptaskresponsebody.md b/docs/models/stoptaskresponsebody.md index e28e433f..a9d917a4 100644 --- a/docs/models/stoptaskresponsebody.md +++ b/docs/models/stoptaskresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { StopTaskResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/stoptranscodesessionerrors.md b/docs/models/stoptranscodesessionerrors.md index 55e8388f..d86900f0 100644 --- a/docs/models/stoptranscodesessionerrors.md +++ b/docs/models/stoptranscodesessionerrors.md @@ -1,5 +1,16 @@ # StopTranscodeSessionErrors +## Example Usage + +```typescript +import { StopTranscodeSessionErrors } from "@lukehagar/plexjs"; + +let value: StopTranscodeSessionErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/stoptranscodesessionrequest.md b/docs/models/stoptranscodesessionrequest.md index ec0ecf06..1d876a2b 100644 --- a/docs/models/stoptranscodesessionrequest.md +++ b/docs/models/stoptranscodesessionrequest.md @@ -1,5 +1,14 @@ # StopTranscodeSessionRequest +## Example Usage + +```typescript +import { StopTranscodeSessionRequest } from "@lukehagar/plexjs"; + +let value: StopTranscodeSessionRequest = { + sessionKey: "zz7llzqlx8w9vnrsbnwhbmep", +}; +``` ## Fields diff --git a/docs/models/stoptranscodesessionresponse.md b/docs/models/stoptranscodesessionresponse.md index 5b372cbd..915c4832 100644 --- a/docs/models/stoptranscodesessionresponse.md +++ b/docs/models/stoptranscodesessionresponse.md @@ -1,5 +1,18 @@ # StopTranscodeSessionResponse +## Example Usage + +```typescript +import { StopTranscodeSessionResponse } from "@lukehagar/plexjs"; + +let value: StopTranscodeSessionResponse = { + contentType: "", + statusCode: 674752, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/stoptranscodesessionresponsebody.md b/docs/models/stoptranscodesessionresponsebody.md index c2230d49..fe024a6c 100644 --- a/docs/models/stoptranscodesessionresponsebody.md +++ b/docs/models/stoptranscodesessionresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { StopTranscodeSessionResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/stream.md b/docs/models/stream.md index 1666b5d2..fd7bce62 100644 --- a/docs/models/stream.md +++ b/docs/models/stream.md @@ -1,5 +1,45 @@ # Stream +## Example Usage + +```typescript +import { Stream } from "@lukehagar/plexjs"; + +let value: Stream = { + id: 29, + streamType: 2, + default: true, + codec: "aac", + index: 0, + bitrate: 128, + bitDepth: 8, + chromaLocation: "left", + chromaSubsampling: "14520", + codedHeight: 816, + codedWidth: 1920, + colorPrimaries: "bt709", + colorRange: "tv", + colorSpace: "bt709", + colorTrc: "bt709", + frameRate: 24, + hasScalingMatrix: false, + height: 814, + level: 40, + profile: "lc", + refFrames: 4, + scanType: "progressive", + streamIdentifier: "1", + width: 1920, + displayTitle: "English (AAC Stereo)", + extendedDisplayTitle: "English (AAC Stereo)", + selected: true, + channels: 2, + language: "English", + languageTag: "en", + languageCode: "eng", + samplingRate: 44100, +}; +``` ## Fields diff --git a/docs/models/subscription.md b/docs/models/subscription.md new file mode 100644 index 00000000..7db04e32 --- /dev/null +++ b/docs/models/subscription.md @@ -0,0 +1,26 @@ +# Subscription + +If the account’s Plex Pass subscription is active + +## Example Usage + +```typescript +import { GetUserDetailsPlexStatus, Subscription } from "@lukehagar/plexjs"; + +let value: Subscription = { + active: true, + subscribedAt: new Date("2021-04-12T18:21:12Z"), + status: GetUserDetailsPlexStatus.Inactive, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `features` | [models.Features](../models/features.md)[] | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `active` | *boolean* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `subscribedAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `status` | [models.GetUserDetailsPlexStatus](../models/getuserdetailsplexstatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `paymentService` | *string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `plan` | *string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/tag.md b/docs/models/tag.md index 99c8927f..538da788 100644 --- a/docs/models/tag.md +++ b/docs/models/tag.md @@ -2,6 +2,13 @@ A key representing a specific tag within the section. +## Example Usage + +```typescript +import { Tag } from "@lukehagar/plexjs"; + +let value: Tag = Tag.Genre; +``` ## Values diff --git a/docs/models/taskname.md b/docs/models/taskname.md index bdefa9d4..dcc0b3d8 100644 --- a/docs/models/taskname.md +++ b/docs/models/taskname.md @@ -2,6 +2,13 @@ the name of the task to be started. +## Example Usage + +```typescript +import { TaskName } from "@lukehagar/plexjs"; + +let value: TaskName = TaskName.GenerateAutoTags; +``` ## Values diff --git a/docs/models/tonight.md b/docs/models/tonight.md index 1404bfb6..83f1c6a6 100644 --- a/docs/models/tonight.md +++ b/docs/models/tonight.md @@ -2,6 +2,13 @@ Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install +## Example Usage + +```typescript +import { Tonight } from "@lukehagar/plexjs"; + +let value: Tonight = Tonight.One; +``` ## Values diff --git a/docs/models/transcodesession.md b/docs/models/transcodesession.md index 72d80369..7f05cf92 100644 --- a/docs/models/transcodesession.md +++ b/docs/models/transcodesession.md @@ -1,5 +1,37 @@ # TranscodeSession +## Example Usage + +```typescript +import { TranscodeSession } from "@lukehagar/plexjs"; + +let value: TranscodeSession = { + key: "vv3i2q2lax92qlzul1hbd4bx", + throttled: false, + complete: false, + progress: 1.7999999523162842, + size: -22, + speed: 25.100000381469727, + error: false, + duration: 1445695, + remaining: 53, + context: "streaming", + sourceVideoCodec: "h264", + sourceAudioCodec: "aac", + videoDecision: "transcode", + audioDecision: "transcode", + subtitleDecision: "burn", + protocol: "http", + container: "mkv", + videoCodec: "h264", + audioCodec: "opus", + audioChannels: 1, + transcodeHwRequested: true, + timeStamp: 1705895805.4919229, + maxOffsetAvailable: 29.53, + minOffsetAvailable: 3.003000020980835, +}; +``` ## Fields diff --git a/docs/models/trials.md b/docs/models/trials.md new file mode 100644 index 00000000..721084cd --- /dev/null +++ b/docs/models/trials.md @@ -0,0 +1,14 @@ +# Trials + +## Example Usage + +```typescript +import { Trials } from "@lukehagar/plexjs"; + +let value: Trials = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/type.md b/docs/models/type.md index 19bb07cd..ce068868 100644 --- a/docs/models/type.md +++ b/docs/models/type.md @@ -2,6 +2,13 @@ Plex content type to search for +## Example Usage + +```typescript +import { Type } from "@lukehagar/plexjs"; + +let value: Type = Type.Three; +``` ## Values diff --git a/docs/models/updateplaylisterrors.md b/docs/models/updateplaylisterrors.md index 4cafaf00..506a140c 100644 --- a/docs/models/updateplaylisterrors.md +++ b/docs/models/updateplaylisterrors.md @@ -1,5 +1,16 @@ # UpdatePlaylistErrors +## Example Usage + +```typescript +import { UpdatePlaylistErrors } from "@lukehagar/plexjs"; + +let value: UpdatePlaylistErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/updateplaylistrequest.md b/docs/models/updateplaylistrequest.md index 8258815e..d2632fe3 100644 --- a/docs/models/updateplaylistrequest.md +++ b/docs/models/updateplaylistrequest.md @@ -1,5 +1,14 @@ # UpdatePlaylistRequest +## Example Usage + +```typescript +import { UpdatePlaylistRequest } from "@lukehagar/plexjs"; + +let value: UpdatePlaylistRequest = { + playlistID: 4386.01, +}; +``` ## Fields diff --git a/docs/models/updateplaylistresponse.md b/docs/models/updateplaylistresponse.md index 99326061..776a9311 100644 --- a/docs/models/updateplaylistresponse.md +++ b/docs/models/updateplaylistresponse.md @@ -1,5 +1,18 @@ # UpdatePlaylistResponse +## Example Usage + +```typescript +import { UpdatePlaylistResponse } from "@lukehagar/plexjs"; + +let value: UpdatePlaylistResponse = { + contentType: "", + statusCode: 634274, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/updateplaylistresponsebody.md b/docs/models/updateplaylistresponsebody.md index ef11a982..c36f9aab 100644 --- a/docs/models/updateplaylistresponsebody.md +++ b/docs/models/updateplaylistresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { UpdatePlaylistResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/updateplayprogresserrors.md b/docs/models/updateplayprogresserrors.md index b5e88264..d85b1607 100644 --- a/docs/models/updateplayprogresserrors.md +++ b/docs/models/updateplayprogresserrors.md @@ -1,5 +1,16 @@ # UpdatePlayProgressErrors +## Example Usage + +```typescript +import { UpdatePlayProgressErrors } from "@lukehagar/plexjs"; + +let value: UpdatePlayProgressErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/updateplayprogressrequest.md b/docs/models/updateplayprogressrequest.md index 882b879d..ea200974 100644 --- a/docs/models/updateplayprogressrequest.md +++ b/docs/models/updateplayprogressrequest.md @@ -1,5 +1,16 @@ # UpdatePlayProgressRequest +## Example Usage + +```typescript +import { UpdatePlayProgressRequest } from "@lukehagar/plexjs"; + +let value: UpdatePlayProgressRequest = { + key: "", + time: 90000, + state: "played", +}; +``` ## Fields diff --git a/docs/models/updateplayprogressresponse.md b/docs/models/updateplayprogressresponse.md index 73b0bb22..a54fb344 100644 --- a/docs/models/updateplayprogressresponse.md +++ b/docs/models/updateplayprogressresponse.md @@ -1,5 +1,18 @@ # UpdatePlayProgressResponse +## Example Usage + +```typescript +import { UpdatePlayProgressResponse } from "@lukehagar/plexjs"; + +let value: UpdatePlayProgressResponse = { + contentType: "", + statusCode: 56713, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/updateplayprogressresponsebody.md b/docs/models/updateplayprogressresponsebody.md index 99482ddb..8b8e6222 100644 --- a/docs/models/updateplayprogressresponsebody.md +++ b/docs/models/updateplayprogressresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { UpdatePlayProgressResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/uploadplaylisterrors.md b/docs/models/uploadplaylisterrors.md index 8ccdf353..70e1bd47 100644 --- a/docs/models/uploadplaylisterrors.md +++ b/docs/models/uploadplaylisterrors.md @@ -1,5 +1,16 @@ # UploadPlaylistErrors +## Example Usage + +```typescript +import { UploadPlaylistErrors } from "@lukehagar/plexjs"; + +let value: UploadPlaylistErrors = { + code: 1001, + message: "User could not be authenticated", + status: 401, +}; +``` ## Fields diff --git a/docs/models/uploadplaylistrequest.md b/docs/models/uploadplaylistrequest.md index e6c9adb5..6b816eda 100644 --- a/docs/models/uploadplaylistrequest.md +++ b/docs/models/uploadplaylistrequest.md @@ -1,5 +1,15 @@ # UploadPlaylistRequest +## Example Usage + +```typescript +import { Force, UploadPlaylistRequest } from "@lukehagar/plexjs"; + +let value: UploadPlaylistRequest = { + path: "/home/barkley/playlist.m3u", + force: Force.One, +}; +``` ## Fields diff --git a/docs/models/uploadplaylistresponse.md b/docs/models/uploadplaylistresponse.md index 6a31aedf..a0e0d08d 100644 --- a/docs/models/uploadplaylistresponse.md +++ b/docs/models/uploadplaylistresponse.md @@ -1,5 +1,18 @@ # UploadPlaylistResponse +## Example Usage + +```typescript +import { UploadPlaylistResponse } from "@lukehagar/plexjs"; + +let value: UploadPlaylistResponse = { + contentType: "", + statusCode: 581850, + rawResponse: new Response('{"message": "hello world"}', { + headers: { "Content-Type": "application/json" }, + }), +}; +``` ## Fields diff --git a/docs/models/uploadplaylistresponsebody.md b/docs/models/uploadplaylistresponsebody.md index 62c3b895..4f5850e0 100644 --- a/docs/models/uploadplaylistresponsebody.md +++ b/docs/models/uploadplaylistresponsebody.md @@ -2,6 +2,13 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +## Example Usage + +```typescript +import { UploadPlaylistResponseBody } from "@lukehagar/plexjs"; + +// No examples available for this model +``` ## Fields diff --git a/docs/models/upscale.md b/docs/models/upscale.md index d87109ce..b7e489b3 100644 --- a/docs/models/upscale.md +++ b/docs/models/upscale.md @@ -2,6 +2,13 @@ allow images to be resized beyond native dimensions. +## Example Usage + +```typescript +import { Upscale } from "@lukehagar/plexjs"; + +let value: Upscale = Upscale.One; +``` ## Values diff --git a/docs/models/userprofile.md b/docs/models/userprofile.md new file mode 100644 index 00000000..baefaa77 --- /dev/null +++ b/docs/models/userprofile.md @@ -0,0 +1,31 @@ +# UserProfile + +## Example Usage + +```typescript +import { UserProfile } from "@lukehagar/plexjs"; + +let value: UserProfile = { + autoSelectAudio: true, + defaultAudioLanguage: "ja", + defaultSubtitleLanguage: "en", + autoSelectSubtitle: 1, + defaultSubtitleAccessibility: 1, + defaultSubtitleForced: 0, + watchedIndicator: 1, + mediaReviewsVisibility: 0, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `autoSelectAudio` | *boolean* | :heavy_minus_sign: | If the account has automatically select audio and subtitle tracks enabled | true | +| `defaultAudioLanguage` | *string* | :heavy_minus_sign: | The preferred audio language for the account | ja | +| `defaultSubtitleLanguage` | *string* | :heavy_minus_sign: | The preferred subtitle language for the account | en | +| `autoSelectSubtitle` | *number* | :heavy_minus_sign: | The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) | 1 | +| `defaultSubtitleAccessibility` | *number* | :heavy_minus_sign: | The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) | 1 | +| `defaultSubtitleForced` | *number* | :heavy_minus_sign: | The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) | 0 | +| `watchedIndicator` | *number* | :heavy_minus_sign: | N/A | 1 | +| `mediaReviewsVisibility` | *number* | :heavy_minus_sign: | N/A | 0 | \ No newline at end of file diff --git a/docs/models/writer.md b/docs/models/writer.md index 6d67cadf..9554261c 100644 --- a/docs/models/writer.md +++ b/docs/models/writer.md @@ -1,5 +1,14 @@ # Writer +## Example Usage + +```typescript +import { Writer } from "@lukehagar/plexjs"; + +let value: Writer = { + tag: "Jeff Loveness", +}; +``` ## Fields diff --git a/docs/sdks/activities/README.md b/docs/sdks/activities/README.md index 4e78a4b4..8b7666ee 100644 --- a/docs/sdks/activities/README.md +++ b/docs/sdks/activities/README.md @@ -41,17 +41,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { activitiesGetServerActivities } from "@lukehagar/plexjs/funcs/activitiesGetServerActivities.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await activitiesGetServerActivities(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetServerActivitiesResponse](../../models/getserveractivitiesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -59,6 +91,7 @@ run(); | models.GetServerActivitiesActivitiesResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## cancelServerActivities Cancel Server Activities @@ -83,6 +116,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { activitiesCancelServerActivities } from "@lukehagar/plexjs/funcs/activitiesCancelServerActivities.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await activitiesCancelServerActivities(plexAPI, "25b71ed5-0f9d-461c-baa7-d404e9e10d3e"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -90,11 +154,12 @@ run(); | `activityUUID` | *string* | :heavy_check_mark: | The UUID of the activity to cancel. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.CancelServerActivitiesResponse](../../models/cancelserveractivitiesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md index d5e52d5f..c0166bc1 100644 --- a/docs/sdks/authentication/README.md +++ b/docs/sdks/authentication/README.md @@ -36,6 +36,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { GetTransientTokenQueryParamType, Scope } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { authenticationGetTransientToken } from "@lukehagar/plexjs/funcs/authenticationGetTransientToken.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await authenticationGetTransientToken(plexAPI, GetTransientTokenQueryParamType.Delegation, Scope.All); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -44,11 +76,12 @@ run(); | `scope` | [models.Scope](../../models/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetTransientTokenResponse](../../models/gettransienttokenresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -56,6 +89,7 @@ run(); | models.GetTransientTokenResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getSourceConnectionInformation If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token. @@ -82,6 +116,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { authenticationGetSourceConnectionInformation } from "@lukehagar/plexjs/funcs/authenticationGetSourceConnectionInformation.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await authenticationGetSourceConnectionInformation(plexAPI, "provider://provider-identifier"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -89,11 +154,12 @@ run(); | `source` | *string* | :heavy_check_mark: | The source identifier with an included prefix. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetSourceConnectionInformationResponse](../../models/getsourceconnectioninformationresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/butler/README.md b/docs/sdks/butler/README.md index acec30e1..d741dbcb 100644 --- a/docs/sdks/butler/README.md +++ b/docs/sdks/butler/README.md @@ -38,17 +38,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { butlerGetButlerTasks } from "@lukehagar/plexjs/funcs/butlerGetButlerTasks.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await butlerGetButlerTasks(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetButlerTasksResponse](../../models/getbutlertasksresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -56,6 +88,7 @@ run(); | models.GetButlerTasksButlerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## startAllTasks This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria: @@ -85,17 +118,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { butlerStartAllTasks } from "@lukehagar/plexjs/funcs/butlerStartAllTasks.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await butlerStartAllTasks(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.StartAllTasksResponse](../../models/startalltasksresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -103,6 +168,7 @@ run(); | models.StartAllTasksResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## stopAllTasks This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue. @@ -128,17 +194,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { butlerStopAllTasks } from "@lukehagar/plexjs/funcs/butlerStopAllTasks.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await butlerStopAllTasks(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.StopAllTasksResponse](../../models/stopalltasksresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -146,6 +244,7 @@ run(); | models.StopAllTasksResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## startTask This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria: @@ -175,6 +274,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { TaskName } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { butlerStartTask } from "@lukehagar/plexjs/funcs/butlerStartTask.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await butlerStartTask(plexAPI, TaskName.DeepMediaAnalysis); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -182,11 +313,12 @@ run(); | `taskName` | [models.TaskName](../../models/taskname.md) | :heavy_check_mark: | the name of the task to be started. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.StartTaskResponse](../../models/starttaskresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -194,6 +326,7 @@ run(); | models.StartTaskResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## stopTask This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint. @@ -219,6 +352,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PathParamTaskName } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { butlerStopTask } from "@lukehagar/plexjs/funcs/butlerStopTask.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await butlerStopTask(plexAPI, PathParamTaskName.RefreshPeriodicMetadata); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -226,11 +391,12 @@ run(); | `taskName` | [models.PathParamTaskName](../../models/pathparamtaskname.md) | :heavy_check_mark: | The name of the task to be started. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.StopTaskResponse](../../models/stoptaskresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/hubs/README.md b/docs/sdks/hubs/README.md index d17d72bb..2e36c2cc 100644 --- a/docs/sdks/hubs/README.md +++ b/docs/sdks/hubs/README.md @@ -18,7 +18,7 @@ Get Global Hubs filtered by the parameters provided. ### Example Usage ```typescript -import { OnlyTransient, PlexAPI } from "@lukehagar/plexjs"; +import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", @@ -26,7 +26,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.hubs.getGlobalHubs(1262.49, OnlyTransient.One); + const result = await plexAPI.hubs.getGlobalHubs(); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { hubsGetGlobalHubs } from "@lukehagar/plexjs/funcs/hubsGetGlobalHubs.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await hubsGetGlobalHubs(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -43,11 +74,12 @@ run(); | `onlyTransient` | [models.OnlyTransient](../../models/onlytransient.md) | :heavy_minus_sign: | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetGlobalHubsResponse](../../models/getglobalhubsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -55,6 +87,7 @@ run(); | models.GetGlobalHubsHubsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getLibraryHubs This endpoint will return a list of library specific hubs @@ -63,7 +96,7 @@ This endpoint will return a list of library specific hubs ### Example Usage ```typescript -import { PlexAPI, QueryParamOnlyTransient } from "@lukehagar/plexjs"; +import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", @@ -71,7 +104,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.hubs.getLibraryHubs(6728.76, 9010.22, QueryParamOnlyTransient.Zero); + const result = await plexAPI.hubs.getLibraryHubs(6728.76); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { hubsGetLibraryHubs } from "@lukehagar/plexjs/funcs/hubsGetLibraryHubs.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await hubsGetLibraryHubs(plexAPI, 639.24); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -89,11 +153,12 @@ run(); | `onlyTransient` | [models.QueryParamOnlyTransient](../../models/queryparamonlytransient.md) | :heavy_minus_sign: | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetLibraryHubsResponse](../../models/getlibraryhubsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index 6e4d5210..43dfd25b 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -36,7 +36,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.library.getFileHash("file://C:\Image.png&type=13", 4462.17); + const result = await plexAPI.library.getFileHash("file://C:\Image.png&type=13"); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetFileHash } from "@lukehagar/plexjs/funcs/libraryGetFileHash.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetFileHash(plexAPI, "file://C:\Image.png&type=13"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -53,11 +84,12 @@ run(); | `type` | *number* | :heavy_minus_sign: | Item type | | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetFileHashResponse](../../models/getfilehashresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -65,6 +97,7 @@ run(); | models.GetFileHashResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getRecentlyAdded This endpoint will return the recently added content. @@ -90,17 +123,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetRecentlyAdded } from "@lukehagar/plexjs/funcs/libraryGetRecentlyAdded.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetRecentlyAdded(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetRecentlyAddedResponse](../../models/getrecentlyaddedresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -108,6 +173,7 @@ run(); | models.GetRecentlyAddedLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getLibraries A library section (commonly referred to as just a library) is a collection of media. @@ -138,17 +204,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetLibraries } from "@lukehagar/plexjs/funcs/libraryGetLibraries.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetLibraries(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetLibrariesResponse](../../models/getlibrariesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -156,6 +254,7 @@ run(); | models.GetLibrariesLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getLibrary ## Library Details Endpoint @@ -202,7 +301,7 @@ Each type in the library comes with a set of filters and sorts, aiding in buildi ### Example Usage ```typescript -import { IncludeDetails, PlexAPI } from "@lukehagar/plexjs"; +import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", @@ -210,7 +309,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.library.getLibrary(1000, IncludeDetails.Zero); + const result = await plexAPI.library.getLibrary(1000); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetLibrary } from "@lukehagar/plexjs/funcs/libraryGetLibrary.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetLibrary(plexAPI, 1000); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -227,11 +357,12 @@ run(); | `includeDetails` | [models.IncludeDetails](../../models/includedetails.md) | :heavy_minus_sign: | Whether or not to include details for a section (types, filters, and sorts).
Only exists for backwards compatibility, media providers other than the server libraries have it on always.
| | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetLibraryResponse](../../models/getlibraryresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -239,6 +370,7 @@ run(); | models.GetLibraryLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## deleteLibrary Delate a library using a specific section @@ -263,6 +395,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryDeleteLibrary } from "@lukehagar/plexjs/funcs/libraryDeleteLibrary.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryDeleteLibrary(plexAPI, 1000); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -270,11 +433,12 @@ run(); | `sectionId` | *number* | :heavy_check_mark: | the Id of the library to query | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.DeleteLibraryResponse](../../models/deletelibraryresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -282,6 +446,7 @@ run(); | models.DeleteLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getLibraryItems Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: @@ -326,6 +491,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { Tag } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetLibraryItems } from "@lukehagar/plexjs/funcs/libraryGetLibraryItems.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetLibraryItems(plexAPI, "", Tag.FirstCharacter, 1); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -335,11 +532,12 @@ run(); | `includeGuids` | *number* | :heavy_minus_sign: | Adds the Guids object to the response
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetLibraryItemsResponse](../../models/getlibraryitemsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -347,6 +545,7 @@ run(); | models.GetLibraryItemsLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## refreshLibrary This endpoint Refreshes the library. @@ -372,6 +571,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryRefreshLibrary } from "@lukehagar/plexjs/funcs/libraryRefreshLibrary.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryRefreshLibrary(plexAPI, 3179.56); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -379,11 +609,12 @@ run(); | `sectionId` | *number* | :heavy_check_mark: | the Id of the library to refresh | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.RefreshLibraryResponse](../../models/refreshlibraryresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -391,6 +622,7 @@ run(); | models.RefreshLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## searchLibrary Search for content within a specific section of the library. @@ -433,6 +665,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { Type } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { librarySearchLibrary } from "@lukehagar/plexjs/funcs/librarySearchLibrary.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await librarySearchLibrary(plexAPI, 457197, Type.Four); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -441,11 +705,12 @@ run(); | `type` | [models.Type](../../models/type.md) | :heavy_check_mark: | Plex content type to search for | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.SearchLibraryResponse](../../models/searchlibraryresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -453,6 +718,7 @@ run(); | models.SearchLibraryLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getMetadata This endpoint will return the metadata of a library item specified with the ratingKey. @@ -469,7 +735,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.library.getMetadata(8382.31); + const result = await plexAPI.library.getMetadata(17); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetMetadata } from "@lukehagar/plexjs/funcs/libraryGetMetadata.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetMetadata(plexAPI, 17); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -485,11 +782,12 @@ run(); | `ratingKey` | *number* | :heavy_check_mark: | the id of the library item to return the children of. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetMetadataResponse](../../models/getmetadataresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -497,6 +795,7 @@ run(); | models.GetMetadataLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getMetadataChildren This endpoint will return the children of of a library item specified with the ratingKey. @@ -513,7 +812,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.library.getMetadataChildren(1539.14, ""); + const result = await plexAPI.library.getMetadataChildren(1539.14, "Stream"); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetMetadataChildren } from "@lukehagar/plexjs/funcs/libraryGetMetadataChildren.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetMetadataChildren(plexAPI, 5800.4, "Stream"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -530,11 +860,12 @@ run(); | `includeElements` | *string* | :heavy_minus_sign: | Adds additional elements to the response. Supported types are (Stream)
| | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetMetadataChildrenResponse](../../models/getmetadatachildrenresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -542,6 +873,7 @@ run(); | models.GetMetadataChildrenLibraryResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getTopWatchedContent This endpoint will return the top watched content from libraries of a certain type @@ -558,7 +890,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.library.getTopWatchedContent(505531, 1); + const result = await plexAPI.library.getTopWatchedContent(1, 1); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetTopWatchedContent } from "@lukehagar/plexjs/funcs/libraryGetTopWatchedContent.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetTopWatchedContent(plexAPI, 1, 1); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -575,17 +938,19 @@ run(); | `includeGuids` | *number* | :heavy_minus_sign: | Adds the Guids object to the response
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetTopWatchedContentResponse](../../models/gettopwatchedcontentresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | models.SDKError | 4xx-5xx | */* | + ## getOnDeck This endpoint will return the on deck content. @@ -611,17 +976,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { libraryGetOnDeck } from "@lukehagar/plexjs/funcs/libraryGetOnDeck.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await libraryGetOnDeck(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetOnDeckResponse](../../models/getondeckresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/log/README.md b/docs/sdks/log/README.md index 996c1393..0cfecde8 100644 --- a/docs/sdks/log/README.md +++ b/docs/sdks/log/README.md @@ -37,6 +37,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { Level } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { logLogLine } from "@lukehagar/plexjs/funcs/logLogLine.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await logLogLine(plexAPI, Level.One, "Test log message", "Postman"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -46,11 +78,12 @@ run(); | `source` | *string* | :heavy_check_mark: | a string indicating the source of the message. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.LogLineResponse](../../models/loglineresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -58,6 +91,7 @@ run(); | models.LogLineResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## logMultiLine This endpoint allows for the batch addition of log entries to the main Plex Media Server log. @@ -105,6 +139,39 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { logLogMultiLine } from "@lukehagar/plexjs/funcs/logLogMultiLine.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await logLogMultiLine(plexAPI, "level=4&message=Test%20message%201&source=postman + level=3&message=Test%20message%202&source=postman + level=1&message=Test%20message%203&source=postman"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -112,11 +179,12 @@ run(); | `request` | [string](../../models/.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.LogMultiLineResponse](../../models/logmultilineresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -124,6 +192,7 @@ run(); | models.LogMultiLineResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## enablePaperTrail This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time. @@ -149,17 +218,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { logEnablePaperTrail } from "@lukehagar/plexjs/funcs/logEnablePaperTrail.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await logEnablePaperTrail(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.EnablePaperTrailResponse](../../models/enablepapertrailresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/media/README.md b/docs/sdks/media/README.md index 19ae91ca..b007d82d 100644 --- a/docs/sdks/media/README.md +++ b/docs/sdks/media/README.md @@ -36,6 +36,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { mediaMarkPlayed } from "@lukehagar/plexjs/funcs/mediaMarkPlayed.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await mediaMarkPlayed(plexAPI, 59398); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -43,11 +74,12 @@ run(); | `key` | *number* | :heavy_check_mark: | The media key to mark as played | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.MarkPlayedResponse](../../models/markplayedresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -55,6 +87,7 @@ run(); | models.MarkPlayedResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## markUnplayed This will mark the provided media key as Unplayed. @@ -79,6 +112,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { mediaMarkUnplayed } from "@lukehagar/plexjs/funcs/mediaMarkUnplayed.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await mediaMarkUnplayed(plexAPI, 59398); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -86,11 +150,12 @@ run(); | `key` | *number* | :heavy_check_mark: | The media key to mark as Unplayed | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.MarkUnplayedResponse](../../models/markunplayedresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -98,6 +163,7 @@ run(); | models.MarkUnplayedResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## updatePlayProgress This API command can be used to update the play progress of a media item. @@ -123,6 +189,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { mediaUpdatePlayProgress } from "@lukehagar/plexjs/funcs/mediaUpdatePlayProgress.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await mediaUpdatePlayProgress(plexAPI, "", 90000, "played"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -132,11 +229,12 @@ run(); | `state` | *string* | :heavy_check_mark: | The playback state of the media item. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.UpdatePlayProgressResponse](../../models/updateplayprogressresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md index 5ca7fa02..157efcef 100644 --- a/docs/sdks/playlists/README.md +++ b/docs/sdks/playlists/README.md @@ -53,6 +53,43 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { QueryParamType, Smart } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsCreatePlaylist } from "@lukehagar/plexjs/funcs/playlistsCreatePlaylist.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsCreatePlaylist(plexAPI, { + title: "", + type: QueryParamType.Video, + smart: Smart.Zero, + uri: "http://doting-hake.biz", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -60,11 +97,12 @@ run(); | `request` | [models.CreatePlaylistRequest](../../models/createplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.CreatePlaylistResponse](../../models/createplaylistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -72,6 +110,7 @@ run(); | models.CreatePlaylistPlaylistsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getPlaylists Get All Playlists given the specified filters. @@ -79,7 +118,7 @@ Get All Playlists given the specified filters. ### Example Usage ```typescript -import { PlaylistType, PlexAPI, QueryParamSmart } from "@lukehagar/plexjs"; +import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", @@ -87,7 +126,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.playlists.getPlaylists(PlaylistType.Audio, QueryParamSmart.Zero); + const result = await plexAPI.playlists.getPlaylists(); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsGetPlaylists } from "@lukehagar/plexjs/funcs/playlistsGetPlaylists.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsGetPlaylists(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -104,11 +174,12 @@ run(); | `smart` | [models.QueryParamSmart](../../models/queryparamsmart.md) | :heavy_minus_sign: | type of playlists to return (default is all). | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetPlaylistsResponse](../../models/getplaylistsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -116,6 +187,7 @@ run(); | models.GetPlaylistsPlaylistsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getPlaylist Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item: @@ -142,6 +214,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsGetPlaylist } from "@lukehagar/plexjs/funcs/playlistsGetPlaylist.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsGetPlaylist(plexAPI, 7975.52); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -149,11 +252,12 @@ run(); | `playlistID` | *number* | :heavy_check_mark: | the ID of the playlist | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetPlaylistResponse](../../models/getplaylistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -161,6 +265,7 @@ run(); | models.GetPlaylistPlaylistsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## deletePlaylist This endpoint will delete a playlist @@ -186,6 +291,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsDeletePlaylist } from "@lukehagar/plexjs/funcs/playlistsDeletePlaylist.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsDeletePlaylist(plexAPI, 8383.28); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -193,11 +329,12 @@ run(); | `playlistID` | *number* | :heavy_check_mark: | the ID of the playlist | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.DeletePlaylistResponse](../../models/deleteplaylistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -205,6 +342,7 @@ run(); | models.DeletePlaylistResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## updatePlaylist From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}` @@ -221,7 +359,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.playlists.updatePlaylist(3915, "", ""); + const result = await plexAPI.playlists.updatePlaylist(3915); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsUpdatePlaylist } from "@lukehagar/plexjs/funcs/playlistsUpdatePlaylist.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsUpdatePlaylist(plexAPI, 9776.24); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -239,11 +408,12 @@ run(); | `summary` | *string* | :heavy_minus_sign: | summary description of the playlist | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.UpdatePlaylistResponse](../../models/updateplaylistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -251,6 +421,7 @@ run(); | models.UpdatePlaylistResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getPlaylistContents Gets the contents of a playlist. Should be paged by clients via standard mechanisms. @@ -279,6 +450,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsGetPlaylistContents } from "@lukehagar/plexjs/funcs/playlistsGetPlaylistContents.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsGetPlaylistContents(plexAPI, 6161.99, 9457); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -287,11 +489,12 @@ run(); | `type` | *number* | :heavy_check_mark: | the metadata type of the item to return | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetPlaylistContentsResponse](../../models/getplaylistcontentsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -299,6 +502,7 @@ run(); | models.GetPlaylistContentsPlaylistsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## clearPlaylistContents Clears a playlist, only works with dumb playlists. Returns the playlist. @@ -324,6 +528,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsClearPlaylistContents } from "@lukehagar/plexjs/funcs/playlistsClearPlaylistContents.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsClearPlaylistContents(plexAPI, 8890.12); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -331,11 +566,12 @@ run(); | `playlistID` | *number* | :heavy_check_mark: | the ID of the playlist | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.ClearPlaylistContentsResponse](../../models/clearplaylistcontentsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -343,6 +579,7 @@ run(); | models.ClearPlaylistContentsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## addPlaylistContents Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist. @@ -369,6 +606,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsAddPlaylistContents } from "@lukehagar/plexjs/funcs/playlistsAddPlaylistContents.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsAddPlaylistContents(plexAPI, 4298.05, "server://12345/com.plexapp.plugins.library/library/metadata/1", 123); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -378,11 +646,12 @@ run(); | `playQueueID` | *number* | :heavy_minus_sign: | the play queue to add to a playlist | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.AddPlaylistContentsResponse](../../models/addplaylistcontentsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -390,6 +659,7 @@ run(); | models.AddPlaylistContentsPlaylistsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## uploadPlaylist Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file. @@ -415,6 +685,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { Force } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { playlistsUploadPlaylist } from "@lukehagar/plexjs/funcs/playlistsUploadPlaylist.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await playlistsUploadPlaylist(plexAPI, "/home/barkley/playlist.m3u", Force.Zero); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -423,11 +725,12 @@ run(); | `force` | [models.Force](../../models/force.md) | :heavy_check_mark: | Force overwriting of duplicate playlists.
By default, a playlist file uploaded with the same path will overwrite the existing playlist.
The `force` argument is used to disable overwriting.
If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
| | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.UploadPlaylistResponse](../../models/uploadplaylistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/plex/README.md b/docs/sdks/plex/README.md index 9c0a447f..3c4ed476 100644 --- a/docs/sdks/plex/README.md +++ b/docs/sdks/plex/README.md @@ -8,9 +8,240 @@ API Calls that perform operations directly against https://Plex.tv ### Available Operations +* [getCompanionsData](#getcompanionsdata) - Get Companions Data +* [getUserFriends](#getuserfriends) - Get list of friends of the user logged in +* [getGeoData](#getgeodata) - Get Geo Data * [getHomeData](#gethomedata) - Get Plex Home Data +* [getResources](#getresources) - Get Resources * [getPin](#getpin) - Get a Pin -* [getToken](#gettoken) - Get Access Token +* [getTokenByPinId](#gettokenbypinid) - Get Access Token by PinId +* [getUserDetails](#getuserdetails) - Get UserData By Token + +## getCompanionsData + +Get Companions Data + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.plex.getCompanionsData(); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetCompanionsData } from "@lukehagar/plexjs/funcs/plexGetCompanionsData.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetCompanionsData(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | +| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**Promise\<[models.GetCompanionsDataResponse](../../models/getcompanionsdataresponse.md)\>** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | +| models.GetCompanionsDataResponseBody | 401 | application/json | +| models.SDKError | 4xx-5xx | */* | + + +## getUserFriends + +Get friends of provided auth token. + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.plex.getUserFriends(); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetUserFriends } from "@lukehagar/plexjs/funcs/plexGetUserFriends.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetUserFriends(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | +| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**Promise\<[models.GetUserFriendsResponse](../../models/getuserfriendsresponse.md)\>** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models.GetUserFriendsResponseBody | 401 | application/json | +| models.SDKError | 4xx-5xx | */* | + + +## getGeoData + +Returns the geolocation and locale data of the caller + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.plex.getGeoData(); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetGeoData } from "@lukehagar/plexjs/funcs/plexGetGeoData.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetGeoData(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | +| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**Promise\<[models.GetGeoDataResponse](../../models/getgeodataresponse.md)\>** + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| models.GetGeoDataResponseBody | 401 | application/json | +| models.SDKError | 4xx-5xx | */* | + ## getHomeData @@ -36,17 +267,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetHomeData } from "@lukehagar/plexjs/funcs/plexGetHomeData.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetHomeData(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetHomeDataResponse](../../models/gethomedataresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -54,6 +317,85 @@ run(); | models.GetHomeDataPlexResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + +## getResources + +Get Resources + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.plex.getResources("Postman"); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetResources } from "@lukehagar/plexjs/funcs/plexGetResources.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetResources(plexAPI, "Postman"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| [object Object] | +| `includeHttps` | [models.IncludeHttps](../../models/includehttps.md) | :heavy_minus_sign: | Include Https entries in the results | | +| `includeRelay` | [models.IncludeRelay](../../models/includerelay.md) | :heavy_minus_sign: | Include Relay addresses in the results | | +| `includeIPv6` | [models.IncludeIPv6](../../models/includeipv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | +| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 | + +### Response + +**Promise\<[models.GetResourcesResponse](../../models/getresourcesresponse.md)\>** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------- | ------------------------------- | ------------------------------- | +| models.GetResourcesResponseBody | 401 | application/json | +| models.SDKError | 4xx-5xx | */* | + + ## getPin Retrieve a Pin from Plex.tv for authentication flows @@ -68,7 +410,37 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.plex.getPin("Postman", false, "Postman"); + const result = await plexAPI.plex.getPin("Postman", "Postman"); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetPin } from "@lukehagar/plexjs/funcs/plexGetPin.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetPin(plexAPI, "Postman", "Postman"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -86,22 +458,24 @@ run(); | `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 | - ### Response **Promise\<[models.GetPinResponse](../../models/getpinresponse.md)\>** + ### Errors -| Error Object | Status Code | Content Type | -| ----------------------------- | ----------------------------- | ----------------------------- | -| models.GetPinPlexResponseBody | 400 | application/json | -| models.SDKError | 4xx-5xx | */* | +| Error Object | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.GetPinResponseBody | 400 | application/json | +| models.SDKError | 4xx-5xx | */* | -## getToken -Retrieve an Access Token from Plex.tv after the Pin has already been authenticated +## getTokenByPinId + +Retrieve an Access Token from Plex.tv after the Pin has been authenticated ### Example Usage @@ -113,7 +487,37 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.plex.getToken("", "Postman"); + const result = await plexAPI.plex.getTokenByPinId(408895, "Postman"); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetTokenByPinId } from "@lukehagar/plexjs/funcs/plexGetTokenByPinId.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetTokenByPinId(plexAPI, 537318, "Postman"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -126,19 +530,96 @@ run(); | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for | | +| `pinID` | *number* | :heavy_check_mark: | The PinID to retrieve an access token for | | | `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 | - ### Response -**Promise\<[models.GetTokenResponse](../../models/gettokenresponse.md)\>** +**Promise\<[models.GetTokenByPinIdResponse](../../models/gettokenbypinidresponse.md)\>** + ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| models.GetTokenPlexResponseBody | 400 | application/json | -| models.SDKError | 4xx-5xx | */* | +| Error Object | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| models.GetTokenByPinIdResponseBody | 404 | application/json | +| models.SDKError | 4xx-5xx | */* | + + +## getUserDetails + +Get the User data from the provided X-Plex-Token + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.plex.getUserDetails(); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { plexGetUserDetails } from "@lukehagar/plexjs/funcs/plexGetUserDetails.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await plexGetUserDetails(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | +| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**Promise\<[models.GetUserDetailsResponse](../../models/getuserdetailsresponse.md)\>** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models.GetUserDetailsResponseBody | 401 | application/json | +| models.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/plexapi/README.md b/docs/sdks/plexapi/README.md index 8ee580cf..16ebfce5 100644 --- a/docs/sdks/plexapi/README.md +++ b/docs/sdks/plexapi/README.md @@ -1,9 +1,5 @@ # PlexAPI SDK - ## Overview -An Open API Spec for interacting with Plex.tv and Plex Servers - -### Available Operations - +Plex-API: An Open API Spec for interacting with Plex.tv \ No newline at end of file diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index d4cf1cfa..b18491fe 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -39,7 +39,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.search.performSearch("dylan", 1516.53, 5); + const result = await plexAPI.search.performSearch("dylan", 5); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { searchPerformSearch } from "@lukehagar/plexjs/funcs/searchPerformSearch.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await searchPerformSearch(plexAPI, "dylan", 5); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -57,11 +88,12 @@ run(); | `limit` | *number* | :heavy_minus_sign: | The number of items to return per hub | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.PerformSearchResponse](../../models/performsearchresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -69,6 +101,7 @@ run(); | models.PerformSearchResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## performVoiceSearch This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint. @@ -88,7 +121,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.search.performVoiceSearch("dead+poop", 4094.8, 5); + const result = await plexAPI.search.performVoiceSearch("dead+poop", 5); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { searchPerformVoiceSearch } from "@lukehagar/plexjs/funcs/searchPerformVoiceSearch.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await searchPerformVoiceSearch(plexAPI, "dead+poop", 5); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -106,11 +170,12 @@ run(); | `limit` | *number* | :heavy_minus_sign: | The number of items to return per hub | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.PerformVoiceSearchResponse](../../models/performvoicesearchresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -118,6 +183,7 @@ run(); | models.PerformVoiceSearchResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getSearchResults This will search the database for the string provided. @@ -142,6 +208,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { searchGetSearchResults } from "@lukehagar/plexjs/funcs/searchGetSearchResults.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await searchGetSearchResults(plexAPI, "110"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -149,11 +246,12 @@ run(); | `query` | *string* | :heavy_check_mark: | The search query string to use | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetSearchResultsResponse](../../models/getsearchresultsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/server/README.md b/docs/sdks/server/README.md index 599840f2..84344243 100644 --- a/docs/sdks/server/README.md +++ b/docs/sdks/server/README.md @@ -41,17 +41,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetServerCapabilities } from "@lukehagar/plexjs/funcs/serverGetServerCapabilities.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetServerCapabilities(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetServerCapabilitiesResponse](../../models/getservercapabilitiesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -59,6 +91,7 @@ run(); | models.GetServerCapabilitiesServerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getServerPreferences Get Server Preferences @@ -83,17 +116,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetServerPreferences } from "@lukehagar/plexjs/funcs/serverGetServerPreferences.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetServerPreferences(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetServerPreferencesResponse](../../models/getserverpreferencesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -101,6 +166,7 @@ run(); | models.GetServerPreferencesServerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getAvailableClients Get Available Clients @@ -125,17 +191,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetAvailableClients } from "@lukehagar/plexjs/funcs/serverGetAvailableClients.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetAvailableClients(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetAvailableClientsResponse](../../models/getavailableclientsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -143,6 +241,7 @@ run(); | models.GetAvailableClientsServerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getDevices Get Devices @@ -167,17 +266,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetDevices } from "@lukehagar/plexjs/funcs/serverGetDevices.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetDevices(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetDevicesResponse](../../models/getdevicesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -185,6 +316,7 @@ run(); | models.GetDevicesServerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getServerIdentity Get Server Identity @@ -209,17 +341,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetServerIdentity } from "@lukehagar/plexjs/funcs/serverGetServerIdentity.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetServerIdentity(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetServerIdentityResponse](../../models/getserveridentityresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -227,6 +391,7 @@ run(); | models.GetServerIdentityServerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getMyPlexAccount Returns MyPlex Account Information @@ -251,17 +416,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetMyPlexAccount } from "@lukehagar/plexjs/funcs/serverGetMyPlexAccount.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetMyPlexAccount(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetMyPlexAccountResponse](../../models/getmyplexaccountresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -269,6 +466,7 @@ run(); | models.GetMyPlexAccountServerResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getResizedPhoto Plex's Photo transcoder is used throughout the service to serve images at specified sizes. @@ -302,6 +500,46 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { MinSize, Upscale } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetResizedPhoto } from "@lukehagar/plexjs/funcs/serverGetResizedPhoto.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetResizedPhoto(plexAPI, { + width: 110, + height: 165, + opacity: 100, + blur: 20, + minSize: MinSize.One, + upscale: Upscale.Zero, + url: "/library/metadata/49564/thumb/1654258204", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -309,11 +547,12 @@ run(); | `request` | [models.GetResizedPhotoRequest](../../models/getresizedphotorequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetResizedPhotoResponse](../../models/getresizedphotoresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -321,6 +560,7 @@ run(); | models.GetResizedPhotoResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getServerList Get Server List @@ -345,17 +585,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { serverGetServerList } from "@lukehagar/plexjs/funcs/serverGetServerList.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await serverGetServerList(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetServerListResponse](../../models/getserverlistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index d8167542..baf7336a 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -37,17 +37,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { sessionsGetSessions } from "@lukehagar/plexjs/funcs/sessionsGetSessions.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await sessionsGetSessions(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetSessionsResponse](../../models/getsessionsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -55,6 +87,7 @@ run(); | models.GetSessionsSessionsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getSessionHistory This will Retrieve a listing of all history views. @@ -70,7 +103,38 @@ const plexAPI = new PlexAPI({ }); async function run() { - const result = await plexAPI.sessions.getSessionHistory("", 1, {}, 12); + const result = await plexAPI.sessions.getSessionHistory("viewedAt:desc", 1, {}, 12); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { sessionsGetSessionHistory } from "@lukehagar/plexjs/funcs/sessionsGetSessionHistory.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await sessionsGetSessionHistory(plexAPI, "viewedAt:desc", 1, {}, 12); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; // Handle the result console.log(result) @@ -89,11 +153,12 @@ run(); | `librarySectionID` | *number* | :heavy_minus_sign: | Filters the results based on the id of a valid library section
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetSessionHistoryResponse](../../models/getsessionhistoryresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -101,6 +166,7 @@ run(); | models.GetSessionHistorySessionsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getTranscodeSessions Get Transcode Sessions @@ -125,17 +191,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { sessionsGetTranscodeSessions } from "@lukehagar/plexjs/funcs/sessionsGetTranscodeSessions.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await sessionsGetTranscodeSessions(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetTranscodeSessionsResponse](../../models/gettranscodesessionsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -143,6 +241,7 @@ run(); | models.GetTranscodeSessionsSessionsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## stopTranscodeSession Stop a Transcode Session @@ -167,6 +266,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { sessionsStopTranscodeSession } from "@lukehagar/plexjs/funcs/sessionsStopTranscodeSession.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await sessionsStopTranscodeSession(plexAPI, "zz7llzqlx8w9vnrsbnwhbmep"); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -174,11 +304,12 @@ run(); | `sessionKey` | *string* | :heavy_check_mark: | the Key of the transcode session to stop | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.StopTranscodeSessionResponse](../../models/stoptranscodesessionresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/statistics/README.md b/docs/sdks/statistics/README.md index c1ba710b..7320a556 100644 --- a/docs/sdks/statistics/README.md +++ b/docs/sdks/statistics/README.md @@ -36,6 +36,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { statisticsGetStatistics } from "@lukehagar/plexjs/funcs/statisticsGetStatistics.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await statisticsGetStatistics(plexAPI, 4); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -43,11 +74,12 @@ run(); | `timespan` | *number* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetStatisticsResponse](../../models/getstatisticsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -55,6 +87,7 @@ run(); | models.GetStatisticsStatisticsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getResourcesStatistics This will return the resources for the server @@ -79,6 +112,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { statisticsGetResourcesStatistics } from "@lukehagar/plexjs/funcs/statisticsGetResourcesStatistics.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await statisticsGetResourcesStatistics(plexAPI, 4); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -86,11 +150,12 @@ run(); | `timespan` | *number* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetResourcesStatisticsResponse](../../models/getresourcesstatisticsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -98,6 +163,7 @@ run(); | models.GetResourcesStatisticsStatisticsResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## getBandwidthStatistics This will return the bandwidth statistics for the server @@ -122,6 +188,37 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { statisticsGetBandwidthStatistics } from "@lukehagar/plexjs/funcs/statisticsGetBandwidthStatistics.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await statisticsGetBandwidthStatistics(plexAPI, 4); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -129,11 +226,12 @@ run(); | `timespan` | *number* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.GetBandwidthStatisticsResponse](../../models/getbandwidthstatisticsresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/updater/README.md b/docs/sdks/updater/README.md index ddae2b61..08c10654 100644 --- a/docs/sdks/updater/README.md +++ b/docs/sdks/updater/README.md @@ -37,17 +37,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { updaterGetUpdateStatus } from "@lukehagar/plexjs/funcs/updaterGetUpdateStatus.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await updaterGetUpdateStatus(plexAPI); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetUpdateStatusResponse](../../models/getupdatestatusresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -55,6 +87,7 @@ run(); | models.GetUpdateStatusUpdaterResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## checkForUpdates Checking for updates @@ -79,6 +112,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { Download } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { updaterCheckForUpdates } from "@lukehagar/plexjs/funcs/updaterCheckForUpdates.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await updaterCheckForUpdates(plexAPI, Download.One); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -86,11 +151,12 @@ run(); | `download` | [models.Download](../../models/download.md) | :heavy_minus_sign: | Indicate that you want to start download any updates found. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.CheckForUpdatesResponse](../../models/checkforupdatesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -98,6 +164,7 @@ run(); | models.CheckForUpdatesResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## applyUpdates Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed @@ -123,6 +190,38 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { Skip, Tonight } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { updaterApplyUpdates } from "@lukehagar/plexjs/funcs/updaterApplyUpdates.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await updaterApplyUpdates(plexAPI, Tonight.One, Skip.One); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | Example | @@ -131,11 +230,12 @@ run(); | `skip` | [models.Skip](../../models/skip.md) | :heavy_minus_sign: | Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | ### Response **Promise\<[models.ApplyUpdatesResponse](../../models/applyupdatesresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/user/README.md b/docs/sdks/user/README.md new file mode 100644 index 00000000..abd4d08f --- /dev/null +++ b/docs/sdks/user/README.md @@ -0,0 +1,92 @@ +# User +(*user*) + +## Overview + +API Calls that perform operations with Plex Media Server Users + + +### Available Operations + +* [postUsersSigninData](#postuserssignindata) - Get User SignIn Data + +## postUsersSigninData + +Sign in user with username and password and return user data with Plex authentication token + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; + +const plexAPI = new PlexAPI({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const result = await plexAPI.user.postUsersSigninData("Postman", { + login: "username@email.com", + password: "password123", + }); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { userPostUsersSigninData } from "@lukehagar/plexjs/funcs/userPostUsersSigninData.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await userPostUsersSigninData(plexAPI, "Postman", { + login: "username@email.com", + password: "password123", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `xPlexClientIdentifier` | *string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| [object Object] | +| `requestBody` | [models.PostUsersSigninDataRequestBody](../../models/postuserssignindatarequestbody.md) | :heavy_minus_sign: | Login credentials | | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | +| `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 | + +### Response + +**Promise\<[models.PostUsersSigninDataResponse](../../models/postuserssignindataresponse.md)\>** + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| models.PostUsersSigninDataResponseBody | 401 | application/json | +| models.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/video/README.md b/docs/sdks/video/README.md index 08011618..98b56581 100644 --- a/docs/sdks/video/README.md +++ b/docs/sdks/video/README.md @@ -46,6 +46,49 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { State } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { videoGetTimeline } from "@lukehagar/plexjs/funcs/videoGetTimeline.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await videoGetTimeline(plexAPI, { + ratingKey: 23409, + key: "/library/metadata/23409", + state: State.Playing, + hasMDE: 1, + time: 2000, + duration: 10000, + context: "home:hub.continueWatching", + playQueueItemID: 1, + playBackTime: 2000, + row: 1, + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -53,11 +96,12 @@ run(); | `request` | [models.GetTimelineRequest](../../models/gettimelinerequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.GetTimelineResponse](../../models/gettimelineresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -65,6 +109,7 @@ run(); | models.GetTimelineResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | + ## startUniversalTranscode Begin a Universal Transcode Session @@ -106,6 +151,54 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { videoStartUniversalTranscode } from "@lukehagar/plexjs/funcs/videoStartUniversalTranscode.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await videoStartUniversalTranscode(plexAPI, { + hasMDE: 1, + path: "/library/metadata/23409", + mediaIndex: 0, + partIndex: 0, + protocol: "hls", + fastSeek: 0, + directPlay: 0, + directStream: 0, + subtitleSize: 100, + subtites: "burn", + audioBoost: 100, + location: "lan", + mediaBufferSize: 102400, + session: "zvcage8b7rkioqcm8f4uns4c", + addDebugOverlay: 0, + autoAdjustQuality: 0, + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -113,11 +206,12 @@ run(); | `request` | [models.StartUniversalTranscodeRequest](../../models/startuniversaltranscoderequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | - +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.StartUniversalTranscodeResponse](../../models/startuniversaltranscoderesponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/watchlist/README.md b/docs/sdks/watchlist/README.md index f301ece9..738337c5 100644 --- a/docs/sdks/watchlist/README.md +++ b/docs/sdks/watchlist/README.md @@ -37,6 +37,41 @@ async function run() { run(); ``` +### Standalone function + +The standalone function version of this method: + +```typescript +import { PathParamFilter } from "@lukehagar/plexjs"; +import { PlexAPICore } from "@lukehagar/plexjs/core.js"; +import { watchlistGetWatchlist } from "@lukehagar/plexjs/funcs/watchlistGetWatchlist.js"; + +// Use `PlexAPICore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const plexAPI = new PlexAPICore({ + accessToken: "", + xPlexClientIdentifier: "Postman", +}); + +async function run() { + const res = await watchlistGetWatchlist(plexAPI, { + filter: PathParamFilter.All, + xPlexToken: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result) +} + +run(); +``` + ### Parameters | Parameter | Type | Required | Description | @@ -44,12 +79,13 @@ run(); | `request` | [models.GetWatchlistRequest](../../models/getwatchlistrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | - ### Response **Promise\<[models.GetWatchlistResponse](../../models/getwatchlistresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/jsr.json b/jsr.json index 99a25d79..d73d83f0 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@lukehagar/plexjs", - "version": "0.18.2", + "version": "0.19.0", "exports": { ".": "./src/index.ts", "./models": "./src/models/index.ts", diff --git a/package-lock.json b/package-lock.json index 884fbbc2..690a98a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,13 @@ { "name": "@lukehagar/plexjs", - "version": "0.18.2", + "version": "0.19.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lukehagar/plexjs", - "version": "0.18.2", + "version": "0.19.0", "devDependencies": { - "@types/jsonpath": "^0.2.4", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", "eslint": "^8.57.0", @@ -210,12 +209,6 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "node_modules/@types/jsonpath": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@types/jsonpath/-/jsonpath-0.2.4.tgz", - "integrity": "sha512-K3hxB8Blw0qgW6ExKgMbXQv2UPZBoE2GqLpVY+yr7nMD2Pq86lsuIzyAaiQ7eMqFL5B6di6pxSkogLJEyEHoGA==", - "dev": true - }, "node_modules/@types/semver": { "version": "7.5.8", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", @@ -3188,12 +3181,6 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, - "@types/jsonpath": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@types/jsonpath/-/jsonpath-0.2.4.tgz", - "integrity": "sha512-K3hxB8Blw0qgW6ExKgMbXQv2UPZBoE2GqLpVY+yr7nMD2Pq86lsuIzyAaiQ7eMqFL5B6di6pxSkogLJEyEHoGA==", - "dev": true - }, "@types/semver": { "version": "7.5.8", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", diff --git a/package.json b/package.json index 4ed85ac1..3b32c73a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@lukehagar/plexjs", - "version": "0.18.2", - "author": "LukeHagar", + "version": "0.19.0", + "author": "LukeHagar", "main": "./index.js", "sideEffects": false, "repository": { @@ -18,7 +18,6 @@ "zod": ">= 3" }, "devDependencies": { - "@types/jsonpath": "^0.2.4", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", "eslint": "^8.57.0", diff --git a/src/core.ts b/src/core.ts new file mode 100644 index 00000000..7fab3202 --- /dev/null +++ b/src/core.ts @@ -0,0 +1,13 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { ClientSDK } from "./lib/sdks.js"; + +/** + * A minimal client to use when calling standalone SDK functions. Typically, an + * instance of this class would be instantiated once at the start of an + * application and passed around through some dependency injection mechanism to + * parts of an application that need to make SDK calls. + */ +export class PlexAPICore extends ClientSDK {} diff --git a/src/funcs/activitiesCancelServerActivities.ts b/src/funcs/activitiesCancelServerActivities.ts new file mode 100644 index 00000000..cecc73f3 --- /dev/null +++ b/src/funcs/activitiesCancelServerActivities.ts @@ -0,0 +1,139 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Cancel Server Activities + * + * @remarks + * Cancel Server Activities + */ +export async function activitiesCancelServerActivities( + client$: PlexAPICore, + activityUUID: string, + options?: RequestOptions +): Promise< + Result< + models.CancelServerActivitiesResponse, + | models.CancelServerActivitiesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.CancelServerActivitiesRequest = { + activityUUID: activityUUID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.CancelServerActivitiesRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + activityUUID: encodeSimple$("activityUUID", payload$.activityUUID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/activities/{activityUUID}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "cancelServerActivities", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.CancelServerActivitiesResponse, + | models.CancelServerActivitiesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.CancelServerActivitiesResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.CancelServerActivitiesResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/activitiesGetServerActivities.ts b/src/funcs/activitiesGetServerActivities.ts new file mode 100644 index 00000000..7acd9f80 --- /dev/null +++ b/src/funcs/activitiesGetServerActivities.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Server Activities + * + * @remarks + * Get Server Activities + */ +export async function activitiesGetServerActivities( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetServerActivitiesResponse, + | models.GetServerActivitiesActivitiesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/activities")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getServerActivities", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetServerActivitiesResponse, + | models.GetServerActivitiesActivitiesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetServerActivitiesResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetServerActivitiesActivitiesResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/authenticationGetSourceConnectionInformation.ts b/src/funcs/authenticationGetSourceConnectionInformation.ts new file mode 100644 index 00000000..06c658b5 --- /dev/null +++ b/src/funcs/authenticationGetSourceConnectionInformation.ts @@ -0,0 +1,139 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Source Connection Information + * + * @remarks + * If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token. + * Note: requires Plex Media Server >= 1.15.4. + * + */ +export async function authenticationGetSourceConnectionInformation( + client$: PlexAPICore, + source: string, + options?: RequestOptions +): Promise< + Result< + models.GetSourceConnectionInformationResponse, + | models.GetSourceConnectionInformationResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetSourceConnectionInformationRequest = { + source: source, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetSourceConnectionInformationRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/security/resources")(); + + const query$ = encodeFormQuery$({ + source: payload$.source, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getSourceConnectionInformation", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetSourceConnectionInformationResponse, + | models.GetSourceConnectionInformationResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.GetSourceConnectionInformationResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetSourceConnectionInformationResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/authenticationGetTransientToken.ts b/src/funcs/authenticationGetTransientToken.ts new file mode 100644 index 00000000..01f63ea7 --- /dev/null +++ b/src/funcs/authenticationGetTransientToken.ts @@ -0,0 +1,141 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get a Transient Token. + * + * @remarks + * This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted. + * + */ +export async function authenticationGetTransientToken( + client$: PlexAPICore, + type: models.GetTransientTokenQueryParamType, + scope: models.Scope, + options?: RequestOptions +): Promise< + Result< + models.GetTransientTokenResponse, + | models.GetTransientTokenResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetTransientTokenRequest = { + type: type, + scope: scope, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetTransientTokenRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/security/token")(); + + const query$ = encodeFormQuery$({ + scope: payload$.scope, + type: payload$.type, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getTransientToken", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetTransientTokenResponse, + | models.GetTransientTokenResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.GetTransientTokenResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetTransientTokenResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/butlerGetButlerTasks.ts b/src/funcs/butlerGetButlerTasks.ts new file mode 100644 index 00000000..d0e6778d --- /dev/null +++ b/src/funcs/butlerGetButlerTasks.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Butler tasks + * + * @remarks + * Returns a list of butler tasks + */ +export async function butlerGetButlerTasks( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetButlerTasksResponse, + | models.GetButlerTasksButlerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/butler")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getButlerTasks", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetButlerTasksResponse, + | models.GetButlerTasksButlerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetButlerTasksResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetButlerTasksButlerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/butlerStartAllTasks.ts b/src/funcs/butlerStartAllTasks.ts new file mode 100644 index 00000000..d70aeedc --- /dev/null +++ b/src/funcs/butlerStartAllTasks.ts @@ -0,0 +1,118 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Start all Butler tasks + * + * @remarks + * This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria: + * 1. Any tasks not scheduled to run on the current day will be skipped. + * 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately. + * 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window. + * 4. If we are outside the configured window, the task will start immediately. + * + */ +export async function butlerStartAllTasks( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.StartAllTasksResponse, + | models.StartAllTasksResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/butler")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "startAllTasks", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.StartAllTasksResponse, + | models.StartAllTasksResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.StartAllTasksResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.StartAllTasksResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/butlerStartTask.ts b/src/funcs/butlerStartTask.ts new file mode 100644 index 00000000..e72f6cc2 --- /dev/null +++ b/src/funcs/butlerStartTask.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Start a single Butler task + * + * @remarks + * This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria: + * 1. Any tasks not scheduled to run on the current day will be skipped. + * 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately. + * 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window. + * 4. If we are outside the configured window, the task will start immediately. + * + */ +export async function butlerStartTask( + client$: PlexAPICore, + taskName: models.TaskName, + options?: RequestOptions +): Promise< + Result< + models.StartTaskResponse, + | models.StartTaskResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.StartTaskRequest = { + taskName: taskName, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.StartTaskRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + taskName: encodeSimple$("taskName", payload$.taskName, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/butler/{taskName}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "startTask", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.StartTaskResponse, + | models.StartTaskResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil([200, 202], models.StartTaskResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.StartTaskResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/butlerStopAllTasks.ts b/src/funcs/butlerStopAllTasks.ts new file mode 100644 index 00000000..2378044c --- /dev/null +++ b/src/funcs/butlerStopAllTasks.ts @@ -0,0 +1,114 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Stop all Butler tasks + * + * @remarks + * This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue. + * + */ +export async function butlerStopAllTasks( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.StopAllTasksResponse, + | models.StopAllTasksResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/butler")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "stopAllTasks", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.StopAllTasksResponse, + | models.StopAllTasksResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.StopAllTasksResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.StopAllTasksResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/butlerStopTask.ts b/src/funcs/butlerStopTask.ts new file mode 100644 index 00000000..0fe027ce --- /dev/null +++ b/src/funcs/butlerStopTask.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Stop a single Butler task + * + * @remarks + * This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint. + * + */ +export async function butlerStopTask( + client$: PlexAPICore, + taskName: models.PathParamTaskName, + options?: RequestOptions +): Promise< + Result< + models.StopTaskResponse, + | models.StopTaskResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.StopTaskRequest = { + taskName: taskName, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.StopTaskRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + taskName: encodeSimple$("taskName", payload$.taskName, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/butler/{taskName}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "stopTask", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "404", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.StopTaskResponse, + | models.StopTaskResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.StopTaskResponse$inboundSchema), + m$.fail([400, 404, "4XX", "5XX"]), + m$.jsonErr(401, models.StopTaskResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/hubsGetGlobalHubs.ts b/src/funcs/hubsGetGlobalHubs.ts new file mode 100644 index 00000000..01aa4381 --- /dev/null +++ b/src/funcs/hubsGetGlobalHubs.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Global Hubs + * + * @remarks + * Get Global Hubs filtered by the parameters provided. + */ +export async function hubsGetGlobalHubs( + client$: PlexAPICore, + count?: number | undefined, + onlyTransient?: models.OnlyTransient | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetGlobalHubsResponse, + | models.GetGlobalHubsHubsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetGlobalHubsRequest = { + count: count, + onlyTransient: onlyTransient, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetGlobalHubsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/hubs")(); + + const query$ = encodeFormQuery$({ + count: payload$.count, + onlyTransient: payload$.onlyTransient, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getGlobalHubs", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetGlobalHubsResponse, + | models.GetGlobalHubsHubsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetGlobalHubsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetGlobalHubsHubsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/hubsGetLibraryHubs.ts b/src/funcs/hubsGetLibraryHubs.ts new file mode 100644 index 00000000..adc3808e --- /dev/null +++ b/src/funcs/hubsGetLibraryHubs.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get library specific hubs + * + * @remarks + * This endpoint will return a list of library specific hubs + * + */ +export async function hubsGetLibraryHubs( + client$: PlexAPICore, + sectionId: number, + count?: number | undefined, + onlyTransient?: models.QueryParamOnlyTransient | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetLibraryHubsResponse, + | models.GetLibraryHubsHubsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetLibraryHubsRequest = { + sectionId: sectionId, + count: count, + onlyTransient: onlyTransient, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetLibraryHubsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sectionId: encodeSimple$("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/hubs/sections/{sectionId}")(pathParams$); + + const query$ = encodeFormQuery$({ + count: payload$.count, + onlyTransient: payload$.onlyTransient, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getLibraryHubs", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetLibraryHubsResponse, + | models.GetLibraryHubsHubsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetLibraryHubsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetLibraryHubsHubsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryDeleteLibrary.ts b/src/funcs/libraryDeleteLibrary.ts new file mode 100644 index 00000000..cfd0ea89 --- /dev/null +++ b/src/funcs/libraryDeleteLibrary.ts @@ -0,0 +1,139 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete Library Section + * + * @remarks + * Delate a library using a specific section + */ +export async function libraryDeleteLibrary( + client$: PlexAPICore, + sectionId: number, + options?: RequestOptions +): Promise< + Result< + models.DeleteLibraryResponse, + | models.DeleteLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.DeleteLibraryRequest = { + sectionId: sectionId, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.DeleteLibraryRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sectionId: encodeSimple$("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/sections/{sectionId}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "deleteLibrary", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.DeleteLibraryResponse, + | models.DeleteLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.DeleteLibraryResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.DeleteLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetFileHash.ts b/src/funcs/libraryGetFileHash.ts new file mode 100644 index 00000000..3f299eda --- /dev/null +++ b/src/funcs/libraryGetFileHash.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Hash Value + * + * @remarks + * This resource returns hash values for local files + */ +export async function libraryGetFileHash( + client$: PlexAPICore, + url: string, + type?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetFileHashResponse, + | models.GetFileHashResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetFileHashRequest = { + url: url, + type: type, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetFileHashRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/library/hashes")(); + + const query$ = encodeFormQuery$({ + type: payload$.type, + url: payload$.url, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getFileHash", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetFileHashResponse, + | models.GetFileHashResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.GetFileHashResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetFileHashResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetLibraries.ts b/src/funcs/libraryGetLibraries.ts new file mode 100644 index 00000000..8158125b --- /dev/null +++ b/src/funcs/libraryGetLibraries.ts @@ -0,0 +1,119 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get All Libraries + * + * @remarks + * A library section (commonly referred to as just a library) is a collection of media. + * Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. + * For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat. + * + * Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. + * This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year). + * + */ +export async function libraryGetLibraries( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetLibrariesResponse, + | models.GetLibrariesLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/library/sections")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getLibraries", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetLibrariesResponse, + | models.GetLibrariesLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetLibrariesResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetLibrariesLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetLibrary.ts b/src/funcs/libraryGetLibrary.ts new file mode 100644 index 00000000..fdf261b0 --- /dev/null +++ b/src/funcs/libraryGetLibrary.ts @@ -0,0 +1,188 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Library Details + * + * @remarks + * ## Library Details Endpoint + * + * This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. + * + * The details include: + * + * ### Directories + * Organized into three categories: + * + * - **Primary Directories**: + * - Used in some clients for quick access to media subsets (e.g., "All", "On Deck"). + * - Most can be replicated via media queries. + * - Customizable by users. + * + * - **Secondary Directories**: + * - Marked with `secondary="1"`. + * - Used in older clients for structured navigation. + * + * - **Special Directories**: + * - Includes a "By Folder" entry for filesystem-based browsing. + * - Contains an obsolete `search="1"` entry for on-the-fly search dialog creation. + * + * ### Types + * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: + * + * - **Type Object Attributes**: + * - `key`: Endpoint for the media list of this type. + * - `type`: Metadata type (if standard Plex type). + * - `title`: Title for this content type (e.g., "Movies"). + * + * - **Filter Objects**: + * - Subset of the media query language. + * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. + * + * - **Sort Objects**: + * - Description of sort fields. + * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. + * + * > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. + * + */ +export async function libraryGetLibrary( + client$: PlexAPICore, + sectionId: number, + includeDetails?: models.IncludeDetails | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetLibraryResponse, + | models.GetLibraryLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetLibraryRequest = { + sectionId: sectionId, + includeDetails: includeDetails, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetLibraryRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sectionId: encodeSimple$("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/sections/{sectionId}")(pathParams$); + + const query$ = encodeFormQuery$({ + includeDetails: payload$.includeDetails, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getLibrary", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetLibraryResponse, + | models.GetLibraryLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetLibraryResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetLibraryLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetLibraryItems.ts b/src/funcs/libraryGetLibraryItems.ts new file mode 100644 index 00000000..e4601625 --- /dev/null +++ b/src/funcs/libraryGetLibraryItems.ts @@ -0,0 +1,172 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Library Items + * + * @remarks + * Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: + * - `all`: All items in the section. + * - `unwatched`: Items that have not been played. + * - `newest`: Items that are recently released. + * - `recentlyAdded`: Items that are recently added to the library. + * - `recentlyViewed`: Items that were recently viewed. + * - `onDeck`: Items to continue watching. + * - `collection`: Items categorized by collection. + * - `edition`: Items categorized by edition. + * - `genre`: Items categorized by genre. + * - `year`: Items categorized by year of release. + * - `decade`: Items categorized by decade. + * - `director`: Items categorized by director. + * - `actor`: Items categorized by starring actor. + * - `country`: Items categorized by country of origin. + * - `contentRating`: Items categorized by content rating. + * - `rating`: Items categorized by rating. + * - `resolution`: Items categorized by resolution. + * - `firstCharacter`: Items categorized by the first letter. + * - `folder`: Items categorized by folder. + * + */ +export async function libraryGetLibraryItems( + client$: PlexAPICore, + sectionId: any, + tag: models.Tag, + includeGuids?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetLibraryItemsResponse, + | models.GetLibraryItemsLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetLibraryItemsRequest = { + sectionId: sectionId, + tag: tag, + includeGuids: includeGuids, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetLibraryItemsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sectionId: encodeSimple$("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + tag: encodeSimple$("tag", payload$.tag, { explode: false, charEncoding: "percent" }), + }; + + const path$ = pathToFunc("/library/sections/{sectionId}/{tag}")(pathParams$); + + const query$ = encodeFormQuery$({ + includeGuids: payload$.includeGuids, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getLibraryItems", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetLibraryItemsResponse, + | models.GetLibraryItemsLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetLibraryItemsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetLibraryItemsLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetMetadata.ts b/src/funcs/libraryGetMetadata.ts new file mode 100644 index 00000000..5e03a646 --- /dev/null +++ b/src/funcs/libraryGetMetadata.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Items Metadata + * + * @remarks + * This endpoint will return the metadata of a library item specified with the ratingKey. + * + */ +export async function libraryGetMetadata( + client$: PlexAPICore, + ratingKey: number, + options?: RequestOptions +): Promise< + Result< + models.GetMetadataResponse, + | models.GetMetadataLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetMetadataRequest = { + ratingKey: ratingKey, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetMetadataRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + ratingKey: encodeSimple$("ratingKey", payload$.ratingKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/metadata/{ratingKey}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getMetadata", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetMetadataResponse, + | models.GetMetadataLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetMetadataResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetMetadataLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetMetadataChildren.ts b/src/funcs/libraryGetMetadataChildren.ts new file mode 100644 index 00000000..0587bdcf --- /dev/null +++ b/src/funcs/libraryGetMetadataChildren.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Items Children + * + * @remarks + * This endpoint will return the children of of a library item specified with the ratingKey. + * + */ +export async function libraryGetMetadataChildren( + client$: PlexAPICore, + ratingKey: number, + includeElements?: string | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetMetadataChildrenResponse, + | models.GetMetadataChildrenLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetMetadataChildrenRequest = { + ratingKey: ratingKey, + includeElements: includeElements, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetMetadataChildrenRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + ratingKey: encodeSimple$("ratingKey", payload$.ratingKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/metadata/{ratingKey}/children")(pathParams$); + + const query$ = encodeFormQuery$({ + includeElements: payload$.includeElements, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getMetadataChildren", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetMetadataChildrenResponse, + | models.GetMetadataChildrenLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetMetadataChildrenResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetMetadataChildrenLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetOnDeck.ts b/src/funcs/libraryGetOnDeck.ts new file mode 100644 index 00000000..d09e87db --- /dev/null +++ b/src/funcs/libraryGetOnDeck.ts @@ -0,0 +1,114 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get On Deck + * + * @remarks + * This endpoint will return the on deck content. + * + */ +export async function libraryGetOnDeck( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetOnDeckResponse, + | models.GetOnDeckLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/library/onDeck")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getOnDeck", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetOnDeckResponse, + | models.GetOnDeckLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetOnDeckResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetOnDeckLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetRecentlyAdded.ts b/src/funcs/libraryGetRecentlyAdded.ts new file mode 100644 index 00000000..ddf5aca8 --- /dev/null +++ b/src/funcs/libraryGetRecentlyAdded.ts @@ -0,0 +1,114 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Recently Added + * + * @remarks + * This endpoint will return the recently added content. + * + */ +export async function libraryGetRecentlyAdded( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetRecentlyAddedResponse, + | models.GetRecentlyAddedLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/library/recentlyAdded")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getRecentlyAdded", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetRecentlyAddedResponse, + | models.GetRecentlyAddedLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetRecentlyAddedResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetRecentlyAddedLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryGetTopWatchedContent.ts b/src/funcs/libraryGetTopWatchedContent.ts new file mode 100644 index 00000000..7ab1ae0c --- /dev/null +++ b/src/funcs/libraryGetTopWatchedContent.ts @@ -0,0 +1,138 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Top Watched Content + * + * @remarks + * This endpoint will return the top watched content from libraries of a certain type + * + */ +export async function libraryGetTopWatchedContent( + client$: PlexAPICore, + type: number, + includeGuids?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetTopWatchedContentResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetTopWatchedContentRequest = { + type: type, + includeGuids: includeGuids, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetTopWatchedContentRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/library/all/top")(); + + const query$ = encodeFormQuery$({ + includeGuids: payload$.includeGuids, + type: payload$.type, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getTopWatchedContent", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetTopWatchedContentResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetTopWatchedContentResponse$inboundSchema, { key: "object" }), + m$.fail(["4XX", "5XX"]) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/libraryRefreshLibrary.ts b/src/funcs/libraryRefreshLibrary.ts new file mode 100644 index 00000000..a0b7dc3b --- /dev/null +++ b/src/funcs/libraryRefreshLibrary.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Refresh Library + * + * @remarks + * This endpoint Refreshes the library. + * + */ +export async function libraryRefreshLibrary( + client$: PlexAPICore, + sectionId: number, + options?: RequestOptions +): Promise< + Result< + models.RefreshLibraryResponse, + | models.RefreshLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.RefreshLibraryRequest = { + sectionId: sectionId, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.RefreshLibraryRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sectionId: encodeSimple$("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/sections/{sectionId}/refresh")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "refreshLibrary", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.RefreshLibraryResponse, + | models.RefreshLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.RefreshLibraryResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.RefreshLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/librarySearchLibrary.ts b/src/funcs/librarySearchLibrary.ts new file mode 100644 index 00000000..b1a8aff1 --- /dev/null +++ b/src/funcs/librarySearchLibrary.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Search Library + * + * @remarks + * Search for content within a specific section of the library. + * + * ### Types + * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: + * + * - **Type Object Attributes**: + * - `type`: Metadata type (if standard Plex type). + * - `title`: Title for this content type (e.g., "Movies"). + * + * - **Filter Objects**: + * - Subset of the media query language. + * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. + * + * - **Sort Objects**: + * - Description of sort fields. + * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. + * + * > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. + * + */ +export async function librarySearchLibrary( + client$: PlexAPICore, + sectionId: number, + type: models.Type, + options?: RequestOptions +): Promise< + Result< + models.SearchLibraryResponse, + | models.SearchLibraryLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.SearchLibraryRequest = { + sectionId: sectionId, + type: type, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.SearchLibraryRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sectionId: encodeSimple$("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/sections/{sectionId}/search")(pathParams$); + + const query$ = encodeFormQuery$({ + type: payload$.type, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "searchLibrary", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.SearchLibraryResponse, + | models.SearchLibraryLibraryResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.SearchLibraryResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.SearchLibraryLibraryResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/logEnablePaperTrail.ts b/src/funcs/logEnablePaperTrail.ts new file mode 100644 index 00000000..161164b8 --- /dev/null +++ b/src/funcs/logEnablePaperTrail.ts @@ -0,0 +1,114 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Enabling Papertrail + * + * @remarks + * This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time. + * + */ +export async function logEnablePaperTrail( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.EnablePaperTrailResponse, + | models.EnablePaperTrailResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/log/networked")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "enablePaperTrail", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "403", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.EnablePaperTrailResponse, + | models.EnablePaperTrailResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.EnablePaperTrailResponse$inboundSchema), + m$.fail([400, 403, "4XX", "5XX"]), + m$.jsonErr(401, models.EnablePaperTrailResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/logLogLine.ts b/src/funcs/logLogLine.ts new file mode 100644 index 00000000..57ededa0 --- /dev/null +++ b/src/funcs/logLogLine.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Logging a single line message. + * + * @remarks + * This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log. + * + */ +export async function logLogLine( + client$: PlexAPICore, + level: models.Level, + message: string, + source: string, + options?: RequestOptions +): Promise< + Result< + models.LogLineResponse, + | models.LogLineResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.LogLineRequest = { + level: level, + message: message, + source: source, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.LogLineRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/log")(); + + const query$ = encodeFormQuery$({ + level: payload$.level, + message: payload$.message, + source: payload$.source, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "logLine", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.LogLineResponse, + | models.LogLineResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.LogLineResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.LogLineResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/logLogMultiLine.ts b/src/funcs/logLogMultiLine.ts new file mode 100644 index 00000000..755c903c --- /dev/null +++ b/src/funcs/logLogMultiLine.ts @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; +import * as z from "zod"; + +/** + * Logging a multi-line message + * + * @remarks + * This endpoint allows for the batch addition of log entries to the main Plex Media Server log. + * It accepts a text/plain request body, where each line represents a distinct log entry. + * Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'. + * + * Log entries are separated by a newline character (`\n`). + * Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters. + * This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests. + * + * The 'level' parameter specifies the log entry's severity or importance, with the following integer values: + * - `0`: Error - Critical issues that require immediate attention. + * - `1`: Warning - Important events that are not critical but may indicate potential issues. + * - `2`: Info - General informational messages about system operation. + * - `3`: Debug - Detailed information useful for debugging purposes. + * - `4`: Verbose - Highly detailed diagnostic information for in-depth analysis. + * + * The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module). + * + * Example of a single log entry format: + * `level=4&message=Sample%20log%20entry&source=applicationName` + * + * Ensure each parameter is properly URL-encoded to avoid interpretation issues. + * + */ +export async function logLogMultiLine( + client$: PlexAPICore, + request: string, + options?: RequestOptions +): Promise< + Result< + models.LogMultiLineResponse, + | models.LogMultiLineResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$ = request; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => z.string().parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = payload$; + + const path$ = pathToFunc("/log")(); + + const headers$ = new Headers({ + "Content-Type": "text/plain", + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "logMultiLine", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.LogMultiLineResponse, + | models.LogMultiLineResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.LogMultiLineResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.LogMultiLineResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/mediaMarkPlayed.ts b/src/funcs/mediaMarkPlayed.ts new file mode 100644 index 00000000..1f43eb57 --- /dev/null +++ b/src/funcs/mediaMarkPlayed.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Mark Media Played + * + * @remarks + * This will mark the provided media key as Played. + */ +export async function mediaMarkPlayed( + client$: PlexAPICore, + key: number, + options?: RequestOptions +): Promise< + Result< + models.MarkPlayedResponse, + | models.MarkPlayedResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.MarkPlayedRequest = { + key: key, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.MarkPlayedRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/:/scrobble")(); + + const query$ = encodeFormQuery$({ + key: payload$.key, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "markPlayed", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.MarkPlayedResponse, + | models.MarkPlayedResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.MarkPlayedResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.MarkPlayedResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/mediaMarkUnplayed.ts b/src/funcs/mediaMarkUnplayed.ts new file mode 100644 index 00000000..6d0006e4 --- /dev/null +++ b/src/funcs/mediaMarkUnplayed.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Mark Media Unplayed + * + * @remarks + * This will mark the provided media key as Unplayed. + */ +export async function mediaMarkUnplayed( + client$: PlexAPICore, + key: number, + options?: RequestOptions +): Promise< + Result< + models.MarkUnplayedResponse, + | models.MarkUnplayedResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.MarkUnplayedRequest = { + key: key, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.MarkUnplayedRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/:/unscrobble")(); + + const query$ = encodeFormQuery$({ + key: payload$.key, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "markUnplayed", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.MarkUnplayedResponse, + | models.MarkUnplayedResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.MarkUnplayedResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.MarkUnplayedResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/mediaUpdatePlayProgress.ts b/src/funcs/mediaUpdatePlayProgress.ts new file mode 100644 index 00000000..cc2f05f8 --- /dev/null +++ b/src/funcs/mediaUpdatePlayProgress.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Update Media Play Progress + * + * @remarks + * This API command can be used to update the play progress of a media item. + * + */ +export async function mediaUpdatePlayProgress( + client$: PlexAPICore, + key: string, + time: number, + state: string, + options?: RequestOptions +): Promise< + Result< + models.UpdatePlayProgressResponse, + | models.UpdatePlayProgressResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.UpdatePlayProgressRequest = { + key: key, + time: time, + state: state, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.UpdatePlayProgressRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/:/progress")(); + + const query$ = encodeFormQuery$({ + key: payload$.key, + state: payload$.state, + time: payload$.time, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "updatePlayProgress", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.UpdatePlayProgressResponse, + | models.UpdatePlayProgressResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.UpdatePlayProgressResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.UpdatePlayProgressResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsAddPlaylistContents.ts b/src/funcs/playlistsAddPlaylistContents.ts new file mode 100644 index 00000000..afbc6337 --- /dev/null +++ b/src/funcs/playlistsAddPlaylistContents.ts @@ -0,0 +1,154 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Adding to a Playlist + * + * @remarks + * Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist. + * With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist. + * + */ +export async function playlistsAddPlaylistContents( + client$: PlexAPICore, + playlistID: number, + uri: string, + playQueueID?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.AddPlaylistContentsResponse, + | models.AddPlaylistContentsPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.AddPlaylistContentsRequest = { + playlistID: playlistID, + uri: uri, + playQueueID: playQueueID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.AddPlaylistContentsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + playlistID: encodeSimple$("playlistID", payload$.playlistID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/playlists/{playlistID}/items")(pathParams$); + + const query$ = encodeFormQuery$({ + playQueueID: payload$.playQueueID, + uri: payload$.uri, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "addPlaylistContents", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "PUT", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.AddPlaylistContentsResponse, + | models.AddPlaylistContentsPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.AddPlaylistContentsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.AddPlaylistContentsPlaylistsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsClearPlaylistContents.ts b/src/funcs/playlistsClearPlaylistContents.ts new file mode 100644 index 00000000..82c1bed3 --- /dev/null +++ b/src/funcs/playlistsClearPlaylistContents.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete Playlist Contents + * + * @remarks + * Clears a playlist, only works with dumb playlists. Returns the playlist. + * + */ +export async function playlistsClearPlaylistContents( + client$: PlexAPICore, + playlistID: number, + options?: RequestOptions +): Promise< + Result< + models.ClearPlaylistContentsResponse, + | models.ClearPlaylistContentsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.ClearPlaylistContentsRequest = { + playlistID: playlistID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.ClearPlaylistContentsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + playlistID: encodeSimple$("playlistID", payload$.playlistID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/playlists/{playlistID}/items")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "clearPlaylistContents", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.ClearPlaylistContentsResponse, + | models.ClearPlaylistContentsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.ClearPlaylistContentsResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.ClearPlaylistContentsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsCreatePlaylist.ts b/src/funcs/playlistsCreatePlaylist.ts new file mode 100644 index 00000000..25b2d974 --- /dev/null +++ b/src/funcs/playlistsCreatePlaylist.ts @@ -0,0 +1,142 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Create a Playlist + * + * @remarks + * Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass: + * - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`). + * - `playQueueID` - To create a playlist from an existing play queue. + * + */ +export async function playlistsCreatePlaylist( + client$: PlexAPICore, + request: models.CreatePlaylistRequest, + options?: RequestOptions +): Promise< + Result< + models.CreatePlaylistResponse, + | models.CreatePlaylistPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$ = request; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.CreatePlaylistRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/playlists")(); + + const query$ = encodeFormQuery$({ + playQueueID: payload$.playQueueID, + smart: payload$.smart, + title: payload$.title, + type: payload$.type, + uri: payload$.uri, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "createPlaylist", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.CreatePlaylistResponse, + | models.CreatePlaylistPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.CreatePlaylistResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.CreatePlaylistPlaylistsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsDeletePlaylist.ts b/src/funcs/playlistsDeletePlaylist.ts new file mode 100644 index 00000000..a3019c7d --- /dev/null +++ b/src/funcs/playlistsDeletePlaylist.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Deletes a Playlist + * + * @remarks + * This endpoint will delete a playlist + * + */ +export async function playlistsDeletePlaylist( + client$: PlexAPICore, + playlistID: number, + options?: RequestOptions +): Promise< + Result< + models.DeletePlaylistResponse, + | models.DeletePlaylistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.DeletePlaylistRequest = { + playlistID: playlistID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.DeletePlaylistRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + playlistID: encodeSimple$("playlistID", payload$.playlistID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/playlists/{playlistID}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "deletePlaylist", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.DeletePlaylistResponse, + | models.DeletePlaylistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(204, models.DeletePlaylistResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.DeletePlaylistResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsGetPlaylist.ts b/src/funcs/playlistsGetPlaylist.ts new file mode 100644 index 00000000..b3d814ec --- /dev/null +++ b/src/funcs/playlistsGetPlaylist.ts @@ -0,0 +1,141 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Retrieve Playlist + * + * @remarks + * Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item: + * Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing. + * + */ +export async function playlistsGetPlaylist( + client$: PlexAPICore, + playlistID: number, + options?: RequestOptions +): Promise< + Result< + models.GetPlaylistResponse, + | models.GetPlaylistPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetPlaylistRequest = { + playlistID: playlistID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetPlaylistRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + playlistID: encodeSimple$("playlistID", payload$.playlistID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/playlists/{playlistID}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getPlaylist", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetPlaylistResponse, + | models.GetPlaylistPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetPlaylistResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetPlaylistPlaylistsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsGetPlaylistContents.ts b/src/funcs/playlistsGetPlaylistContents.ts new file mode 100644 index 00000000..611a2528 --- /dev/null +++ b/src/funcs/playlistsGetPlaylistContents.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Retrieve Playlist Contents + * + * @remarks + * Gets the contents of a playlist. Should be paged by clients via standard mechanisms. + * By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter. + * For example, you could use this to display a list of recently added albums vis a smart playlist. + * Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items. + * + */ +export async function playlistsGetPlaylistContents( + client$: PlexAPICore, + playlistID: number, + type: number, + options?: RequestOptions +): Promise< + Result< + models.GetPlaylistContentsResponse, + | models.GetPlaylistContentsPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetPlaylistContentsRequest = { + playlistID: playlistID, + type: type, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetPlaylistContentsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + playlistID: encodeSimple$("playlistID", payload$.playlistID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/playlists/{playlistID}/items")(pathParams$); + + const query$ = encodeFormQuery$({ + type: payload$.type, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getPlaylistContents", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetPlaylistContentsResponse, + | models.GetPlaylistContentsPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetPlaylistContentsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetPlaylistContentsPlaylistsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsGetPlaylists.ts b/src/funcs/playlistsGetPlaylists.ts new file mode 100644 index 00000000..d0deb586 --- /dev/null +++ b/src/funcs/playlistsGetPlaylists.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get All Playlists + * + * @remarks + * Get All Playlists given the specified filters. + */ +export async function playlistsGetPlaylists( + client$: PlexAPICore, + playlistType?: models.PlaylistType | undefined, + smart?: models.QueryParamSmart | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetPlaylistsResponse, + | models.GetPlaylistsPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetPlaylistsRequest = { + playlistType: playlistType, + smart: smart, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetPlaylistsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/playlists")(); + + const query$ = encodeFormQuery$({ + playlistType: payload$.playlistType, + smart: payload$.smart, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getPlaylists", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetPlaylistsResponse, + | models.GetPlaylistsPlaylistsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetPlaylistsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetPlaylistsPlaylistsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsUpdatePlaylist.ts b/src/funcs/playlistsUpdatePlaylist.ts new file mode 100644 index 00000000..f71d9ceb --- /dev/null +++ b/src/funcs/playlistsUpdatePlaylist.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Update a Playlist + * + * @remarks + * From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}` + * + */ +export async function playlistsUpdatePlaylist( + client$: PlexAPICore, + playlistID: number, + title?: string | undefined, + summary?: string | undefined, + options?: RequestOptions +): Promise< + Result< + models.UpdatePlaylistResponse, + | models.UpdatePlaylistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.UpdatePlaylistRequest = { + playlistID: playlistID, + title: title, + summary: summary, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.UpdatePlaylistRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + playlistID: encodeSimple$("playlistID", payload$.playlistID, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/playlists/{playlistID}")(pathParams$); + + const query$ = encodeFormQuery$({ + summary: payload$.summary, + title: payload$.title, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "updatePlaylist", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "PUT", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.UpdatePlaylistResponse, + | models.UpdatePlaylistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.UpdatePlaylistResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.UpdatePlaylistResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/playlistsUploadPlaylist.ts b/src/funcs/playlistsUploadPlaylist.ts new file mode 100644 index 00000000..79a1b1ad --- /dev/null +++ b/src/funcs/playlistsUploadPlaylist.ts @@ -0,0 +1,141 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Upload Playlist + * + * @remarks + * Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file. + * + */ +export async function playlistsUploadPlaylist( + client$: PlexAPICore, + path: string, + force: models.Force, + options?: RequestOptions +): Promise< + Result< + models.UploadPlaylistResponse, + | models.UploadPlaylistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.UploadPlaylistRequest = { + path: path, + force: force, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.UploadPlaylistRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/playlists/upload")(); + + const query$ = encodeFormQuery$({ + force: payload$.force, + path: payload$.path, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "uploadPlaylist", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "POST", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.UploadPlaylistResponse, + | models.UploadPlaylistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.UploadPlaylistResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.UploadPlaylistResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetCompanionsData.ts b/src/funcs/plexGetCompanionsData.ts new file mode 100644 index 00000000..43e5bc42 --- /dev/null +++ b/src/funcs/plexGetCompanionsData.ts @@ -0,0 +1,119 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetCompanionsDataOpServerList } from "../models/getcompanionsdataop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Companions Data + * + * @remarks + * Get Companions Data + */ +export async function plexGetCompanionsData( + client$: PlexAPICore, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetCompanionsDataResponse, + | models.GetCompanionsDataResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const baseURL$ = + options?.serverURL || + pathToFunc(GetCompanionsDataOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/companions")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getCompanionsData", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetCompanionsDataResponse, + | models.GetCompanionsDataResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetCompanionsDataResponse$inboundSchema, { key: "responseBodies" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetCompanionsDataResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetGeoData.ts b/src/funcs/plexGetGeoData.ts new file mode 100644 index 00000000..62464e98 --- /dev/null +++ b/src/funcs/plexGetGeoData.ts @@ -0,0 +1,109 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetGeoDataOpServerList } from "../models/getgeodataop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Geo Data + * + * @remarks + * Returns the geolocation and locale data of the caller + */ +export async function plexGetGeoData( + client$: PlexAPICore, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetGeoDataResponse, + | models.GetGeoDataResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const baseURL$ = + options?.serverURL || pathToFunc(GetGeoDataOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/geoip")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const context = { operationID: "getGeoData", oAuth2Scopes: [], securitySource: null }; + + const requestRes = client$.createRequest$( + context, + { + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetGeoDataResponse, + | models.GetGeoDataResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetGeoDataResponse$inboundSchema, { key: "GeoData" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetGeoDataResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetHomeData.ts b/src/funcs/plexGetHomeData.ts new file mode 100644 index 00000000..232acc70 --- /dev/null +++ b/src/funcs/plexGetHomeData.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Plex Home Data + * + * @remarks + * Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status. + */ +export async function plexGetHomeData( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetHomeDataResponse, + | models.GetHomeDataPlexResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/home")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getHomeData", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetHomeDataResponse, + | models.GetHomeDataPlexResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetHomeDataResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetHomeDataPlexResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetPin.ts b/src/funcs/plexGetPin.ts new file mode 100644 index 00000000..a0935e8c --- /dev/null +++ b/src/funcs/plexGetPin.ts @@ -0,0 +1,149 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetPinOpServerList } from "../models/getpinop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get a Pin + * + * @remarks + * Retrieve a Pin from Plex.tv for authentication flows + */ +export async function plexGetPin( + client$: PlexAPICore, + xPlexProduct: string, + strong?: boolean | undefined, + xPlexClientIdentifier?: string | undefined, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetPinResponse, + | models.GetPinResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetPinRequest = { + strong: strong, + xPlexClientIdentifier: xPlexClientIdentifier, + xPlexProduct: xPlexProduct, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetPinRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const baseURL$ = + options?.serverURL || pathToFunc(GetPinOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/pins")(); + + const query$ = encodeFormQuery$({ + strong: payload$.strong, + }); + + const headers$ = new Headers({ + Accept: "application/json", + "X-Plex-Client-Identifier": encodeSimple$( + "X-Plex-Client-Identifier", + payload$["X-Plex-Client-Identifier"] ?? client$.options$.xPlexClientIdentifier, + { explode: false, charEncoding: "none" } + ), + "X-Plex-Product": encodeSimple$("X-Plex-Product", payload$["X-Plex-Product"], { + explode: false, + charEncoding: "none", + }), + }); + + const context = { operationID: "getPin", oAuth2Scopes: [], securitySource: null }; + + const requestRes = client$.createRequest$( + context, + { + method: "POST", + baseURL: baseURL$, + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetPinResponse, + | models.GetPinResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetPinResponse$inboundSchema, { key: "AuthPinContainer" }), + m$.jsonErr(400, models.GetPinResponseBody$inboundSchema), + m$.fail(["4XX", "5XX"]) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetResources.ts b/src/funcs/plexGetResources.ts new file mode 100644 index 00000000..e5b661cc --- /dev/null +++ b/src/funcs/plexGetResources.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetResourcesOpServerList } from "../models/getresourcesop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Resources + * + * @remarks + * Get Resources + */ +export async function plexGetResources( + client$: PlexAPICore, + xPlexClientIdentifier?: string | undefined, + includeHttps?: models.IncludeHttps | undefined, + includeRelay?: models.IncludeRelay | undefined, + includeIPv6?: models.IncludeIPv6 | undefined, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetResourcesResponse, + | models.GetResourcesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetResourcesRequest = { + xPlexClientIdentifier: xPlexClientIdentifier, + includeHttps: includeHttps, + includeRelay: includeRelay, + includeIPv6: includeIPv6, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetResourcesRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const baseURL$ = + options?.serverURL || + pathToFunc(GetResourcesOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/resources")(); + + const query$ = encodeFormQuery$({ + includeHttps: payload$.includeHttps, + includeIPv6: payload$.includeIPv6, + includeRelay: payload$.includeRelay, + }); + + const headers$ = new Headers({ + Accept: "application/json", + "X-Plex-Client-Identifier": encodeSimple$( + "X-Plex-Client-Identifier", + payload$["X-Plex-Client-Identifier"] ?? client$.options$.xPlexClientIdentifier, + { explode: false, charEncoding: "none" } + ), + }); + + const context = { operationID: "getResources", oAuth2Scopes: [], securitySource: null }; + + const requestRes = client$.createRequest$( + context, + { + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetResourcesResponse, + | models.GetResourcesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetResourcesResponse$inboundSchema, { key: "PlexDevices" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetResourcesResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetTokenByPinId.ts b/src/funcs/plexGetTokenByPinId.ts new file mode 100644 index 00000000..7fad9d02 --- /dev/null +++ b/src/funcs/plexGetTokenByPinId.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetTokenByPinIdOpServerList } from "../models/gettokenbypinidop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Access Token by PinId + * + * @remarks + * Retrieve an Access Token from Plex.tv after the Pin has been authenticated + */ +export async function plexGetTokenByPinId( + client$: PlexAPICore, + pinID: number, + xPlexClientIdentifier?: string | undefined, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetTokenByPinIdResponse, + | models.GetTokenByPinIdResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetTokenByPinIdRequest = { + xPlexClientIdentifier: xPlexClientIdentifier, + pinID: pinID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetTokenByPinIdRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const baseURL$ = + options?.serverURL || + pathToFunc(GetTokenByPinIdOpServerList[0], { charEncoding: "percent" })(); + + const pathParams$ = { + pinID: encodeSimple$("pinID", payload$.pinID, { explode: false, charEncoding: "percent" }), + }; + + const path$ = pathToFunc("/pins/{pinID}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + "X-Plex-Client-Identifier": encodeSimple$( + "X-Plex-Client-Identifier", + payload$["X-Plex-Client-Identifier"] ?? client$.options$.xPlexClientIdentifier, + { explode: false, charEncoding: "none" } + ), + }); + + const context = { operationID: "getTokenByPinId", oAuth2Scopes: [], securitySource: null }; + + const requestRes = client$.createRequest$( + context, + { + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "404", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetTokenByPinIdResponse, + | models.GetTokenByPinIdResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetTokenByPinIdResponse$inboundSchema, { key: "AuthPinContainer" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(404, models.GetTokenByPinIdResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetUserDetails.ts b/src/funcs/plexGetUserDetails.ts new file mode 100644 index 00000000..60974f13 --- /dev/null +++ b/src/funcs/plexGetUserDetails.ts @@ -0,0 +1,119 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetUserDetailsOpServerList } from "../models/getuserdetailsop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get UserData By Token + * + * @remarks + * Get the User data from the provided X-Plex-Token + */ +export async function plexGetUserDetails( + client$: PlexAPICore, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetUserDetailsResponse, + | models.GetUserDetailsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const baseURL$ = + options?.serverURL || + pathToFunc(GetUserDetailsOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/user")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getUserDetails", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetUserDetailsResponse, + | models.GetUserDetailsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetUserDetailsResponse$inboundSchema, { key: "UserPlexAccount" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetUserDetailsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/plexGetUserFriends.ts b/src/funcs/plexGetUserFriends.ts new file mode 100644 index 00000000..d280f52a --- /dev/null +++ b/src/funcs/plexGetUserFriends.ts @@ -0,0 +1,119 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetUserFriendsOpServerList } from "../models/getuserfriendsop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get list of friends of the user logged in + * + * @remarks + * Get friends of provided auth token. + */ +export async function plexGetUserFriends( + client$: PlexAPICore, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetUserFriendsResponse, + | models.GetUserFriendsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const baseURL$ = + options?.serverURL || + pathToFunc(GetUserFriendsOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/friends")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getUserFriends", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetUserFriendsResponse, + | models.GetUserFriendsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetUserFriendsResponse$inboundSchema, { key: "Friends" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetUserFriendsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/searchGetSearchResults.ts b/src/funcs/searchGetSearchResults.ts new file mode 100644 index 00000000..6ccc51ce --- /dev/null +++ b/src/funcs/searchGetSearchResults.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Search Results + * + * @remarks + * This will search the database for the string provided. + */ +export async function searchGetSearchResults( + client$: PlexAPICore, + query: string, + options?: RequestOptions +): Promise< + Result< + models.GetSearchResultsResponse, + | models.GetSearchResultsSearchResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetSearchResultsRequest = { + query: query, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetSearchResultsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/search")(); + + const query$ = encodeFormQuery$({ + query: payload$.query, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getSearchResults", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetSearchResultsResponse, + | models.GetSearchResultsSearchResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetSearchResultsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetSearchResultsSearchResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/searchPerformSearch.ts b/src/funcs/searchPerformSearch.ts new file mode 100644 index 00000000..e273f1b8 --- /dev/null +++ b/src/funcs/searchPerformSearch.ts @@ -0,0 +1,155 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Perform a search + * + * @remarks + * This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor). + * + * In the response's items, the following extra attributes are returned to further describe or disambiguate the result: + * + * - `reason`: The reason for the result, if not because of a direct search term match; can be either: + * - `section`: There are multiple identical results from different sections. + * - `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language). + * - ``: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor` + * - `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold"). + * - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID. + * + * This request is intended to be very fast, and called as the user types. + * + */ +export async function searchPerformSearch( + client$: PlexAPICore, + query: string, + sectionId?: number | undefined, + limit?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.PerformSearchResponse, + | models.PerformSearchResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.PerformSearchRequest = { + query: query, + sectionId: sectionId, + limit: limit, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.PerformSearchRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/hubs/search")(); + + const query$ = encodeFormQuery$({ + limit: payload$.limit, + query: payload$.query, + sectionId: payload$.sectionId, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "performSearch", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.PerformSearchResponse, + | models.PerformSearchResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.PerformSearchResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.PerformSearchResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/searchPerformVoiceSearch.ts b/src/funcs/searchPerformVoiceSearch.ts new file mode 100644 index 00000000..9cc9da59 --- /dev/null +++ b/src/funcs/searchPerformVoiceSearch.ts @@ -0,0 +1,147 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Perform a voice search + * + * @remarks + * This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint. + * It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint. + * Whenever possible, clients should limit the search to the appropriate type. + * Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality. + * + */ +export async function searchPerformVoiceSearch( + client$: PlexAPICore, + query: string, + sectionId?: number | undefined, + limit?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.PerformVoiceSearchResponse, + | models.PerformVoiceSearchResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.PerformVoiceSearchRequest = { + query: query, + sectionId: sectionId, + limit: limit, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.PerformVoiceSearchRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/hubs/search/voice")(); + + const query$ = encodeFormQuery$({ + limit: payload$.limit, + query: payload$.query, + sectionId: payload$.sectionId, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "performVoiceSearch", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.PerformVoiceSearchResponse, + | models.PerformVoiceSearchResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.PerformVoiceSearchResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.PerformVoiceSearchResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetAvailableClients.ts b/src/funcs/serverGetAvailableClients.ts new file mode 100644 index 00000000..99092732 --- /dev/null +++ b/src/funcs/serverGetAvailableClients.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Available Clients + * + * @remarks + * Get Available Clients + */ +export async function serverGetAvailableClients( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetAvailableClientsResponse, + | models.GetAvailableClientsServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/clients")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getAvailableClients", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetAvailableClientsResponse, + | models.GetAvailableClientsServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetAvailableClientsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetAvailableClientsServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetDevices.ts b/src/funcs/serverGetDevices.ts new file mode 100644 index 00000000..5ea36a8e --- /dev/null +++ b/src/funcs/serverGetDevices.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Devices + * + * @remarks + * Get Devices + */ +export async function serverGetDevices( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetDevicesResponse, + | models.GetDevicesServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/devices")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getDevices", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetDevicesResponse, + | models.GetDevicesServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetDevicesResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetDevicesServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetMyPlexAccount.ts b/src/funcs/serverGetMyPlexAccount.ts new file mode 100644 index 00000000..b68214ad --- /dev/null +++ b/src/funcs/serverGetMyPlexAccount.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get MyPlex Account + * + * @remarks + * Returns MyPlex Account Information + */ +export async function serverGetMyPlexAccount( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetMyPlexAccountResponse, + | models.GetMyPlexAccountServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/myplex/account")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getMyPlexAccount", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetMyPlexAccountResponse, + | models.GetMyPlexAccountServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetMyPlexAccountResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetMyPlexAccountServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetResizedPhoto.ts b/src/funcs/serverGetResizedPhoto.ts new file mode 100644 index 00000000..041eb04e --- /dev/null +++ b/src/funcs/serverGetResizedPhoto.ts @@ -0,0 +1,142 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get a Resized Photo + * + * @remarks + * Plex's Photo transcoder is used throughout the service to serve images at specified sizes. + * + */ +export async function serverGetResizedPhoto( + client$: PlexAPICore, + request: models.GetResizedPhotoRequest, + options?: RequestOptions +): Promise< + Result< + models.GetResizedPhotoResponse, + | models.GetResizedPhotoResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$ = request; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetResizedPhotoRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/photo/:/transcode")(); + + const query$ = encodeFormQuery$({ + blur: payload$.blur, + height: payload$.height, + minSize: payload$.minSize, + opacity: payload$.opacity, + upscale: payload$.upscale, + url: payload$.url, + width: payload$.width, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getResizedPhoto", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetResizedPhotoResponse, + | models.GetResizedPhotoResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.GetResizedPhotoResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetResizedPhotoResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetServerCapabilities.ts b/src/funcs/serverGetServerCapabilities.ts new file mode 100644 index 00000000..b1e6943f --- /dev/null +++ b/src/funcs/serverGetServerCapabilities.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Server Capabilities + * + * @remarks + * Get Server Capabilities + */ +export async function serverGetServerCapabilities( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetServerCapabilitiesResponse, + | models.GetServerCapabilitiesServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getServerCapabilities", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetServerCapabilitiesResponse, + | models.GetServerCapabilitiesServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetServerCapabilitiesResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetServerCapabilitiesServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetServerIdentity.ts b/src/funcs/serverGetServerIdentity.ts new file mode 100644 index 00000000..8a969592 --- /dev/null +++ b/src/funcs/serverGetServerIdentity.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Server Identity + * + * @remarks + * Get Server Identity + */ +export async function serverGetServerIdentity( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetServerIdentityResponse, + | models.GetServerIdentityServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/identity")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getServerIdentity", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetServerIdentityResponse, + | models.GetServerIdentityServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetServerIdentityResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetServerIdentityServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetServerList.ts b/src/funcs/serverGetServerList.ts new file mode 100644 index 00000000..11462b97 --- /dev/null +++ b/src/funcs/serverGetServerList.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Server List + * + * @remarks + * Get Server List + */ +export async function serverGetServerList( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetServerListResponse, + | models.GetServerListServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/servers")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getServerList", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetServerListResponse, + | models.GetServerListServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetServerListResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetServerListServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/serverGetServerPreferences.ts b/src/funcs/serverGetServerPreferences.ts new file mode 100644 index 00000000..a4e15554 --- /dev/null +++ b/src/funcs/serverGetServerPreferences.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Server Preferences + * + * @remarks + * Get Server Preferences + */ +export async function serverGetServerPreferences( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetServerPreferencesResponse, + | models.GetServerPreferencesServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/:/prefs")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getServerPreferences", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetServerPreferencesResponse, + | models.GetServerPreferencesServerResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetServerPreferencesResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetServerPreferencesServerResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/sessionsGetSessionHistory.ts b/src/funcs/sessionsGetSessionHistory.ts new file mode 100644 index 00000000..106a9486 --- /dev/null +++ b/src/funcs/sessionsGetSessionHistory.ts @@ -0,0 +1,146 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Session History + * + * @remarks + * This will Retrieve a listing of all history views. + */ +export async function sessionsGetSessionHistory( + client$: PlexAPICore, + sort?: string | undefined, + accountId?: number | undefined, + filter?: models.Filter | undefined, + librarySectionID?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetSessionHistoryResponse, + | models.GetSessionHistorySessionsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetSessionHistoryRequest = { + sort: sort, + accountId: accountId, + filter: filter, + librarySectionID: librarySectionID, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetSessionHistoryRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/status/sessions/history/all")(); + + const query$ = encodeFormQuery$({ + accountId: payload$.accountId, + filter: payload$.filter, + librarySectionID: payload$.librarySectionID, + sort: payload$.sort, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getSessionHistory", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetSessionHistoryResponse, + | models.GetSessionHistorySessionsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetSessionHistoryResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetSessionHistorySessionsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/sessionsGetSessions.ts b/src/funcs/sessionsGetSessions.ts new file mode 100644 index 00000000..3c2e7d3c --- /dev/null +++ b/src/funcs/sessionsGetSessions.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Active Sessions + * + * @remarks + * This will retrieve the "Now Playing" Information of the PMS. + */ +export async function sessionsGetSessions( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetSessionsResponse, + | models.GetSessionsSessionsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/status/sessions")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getSessions", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetSessionsResponse, + | models.GetSessionsSessionsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetSessionsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetSessionsSessionsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/sessionsGetTranscodeSessions.ts b/src/funcs/sessionsGetTranscodeSessions.ts new file mode 100644 index 00000000..7e5f27cf --- /dev/null +++ b/src/funcs/sessionsGetTranscodeSessions.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Transcode Sessions + * + * @remarks + * Get Transcode Sessions + */ +export async function sessionsGetTranscodeSessions( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetTranscodeSessionsResponse, + | models.GetTranscodeSessionsSessionsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/transcode/sessions")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getTranscodeSessions", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetTranscodeSessionsResponse, + | models.GetTranscodeSessionsSessionsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetTranscodeSessionsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetTranscodeSessionsSessionsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/sessionsStopTranscodeSession.ts b/src/funcs/sessionsStopTranscodeSession.ts new file mode 100644 index 00000000..6cd7d68f --- /dev/null +++ b/src/funcs/sessionsStopTranscodeSession.ts @@ -0,0 +1,139 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Stop a Transcode Session + * + * @remarks + * Stop a Transcode Session + */ +export async function sessionsStopTranscodeSession( + client$: PlexAPICore, + sessionKey: string, + options?: RequestOptions +): Promise< + Result< + models.StopTranscodeSessionResponse, + | models.StopTranscodeSessionResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.StopTranscodeSessionRequest = { + sessionKey: sessionKey, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.StopTranscodeSessionRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + sessionKey: encodeSimple$("sessionKey", payload$.sessionKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/transcode/sessions/{sessionKey}")(pathParams$); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "stopTranscodeSession", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "DELETE", + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.StopTranscodeSessionResponse, + | models.StopTranscodeSessionResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(204, models.StopTranscodeSessionResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.StopTranscodeSessionResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/statisticsGetBandwidthStatistics.ts b/src/funcs/statisticsGetBandwidthStatistics.ts new file mode 100644 index 00000000..bf4c07cb --- /dev/null +++ b/src/funcs/statisticsGetBandwidthStatistics.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Bandwidth Statistics + * + * @remarks + * This will return the bandwidth statistics for the server + */ +export async function statisticsGetBandwidthStatistics( + client$: PlexAPICore, + timespan?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetBandwidthStatisticsResponse, + | models.GetBandwidthStatisticsStatisticsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetBandwidthStatisticsRequest = { + timespan: timespan, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetBandwidthStatisticsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/statistics/bandwidth")(); + + const query$ = encodeFormQuery$({ + Timespan: payload$.Timespan, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getBandwidthStatistics", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetBandwidthStatisticsResponse, + | models.GetBandwidthStatisticsStatisticsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetBandwidthStatisticsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetBandwidthStatisticsStatisticsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/statisticsGetResourcesStatistics.ts b/src/funcs/statisticsGetResourcesStatistics.ts new file mode 100644 index 00000000..18fd128f --- /dev/null +++ b/src/funcs/statisticsGetResourcesStatistics.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Resources Statistics + * + * @remarks + * This will return the resources for the server + */ +export async function statisticsGetResourcesStatistics( + client$: PlexAPICore, + timespan?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetResourcesStatisticsResponse, + | models.GetResourcesStatisticsStatisticsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetResourcesStatisticsRequest = { + timespan: timespan, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetResourcesStatisticsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/statistics/resources")(); + + const query$ = encodeFormQuery$({ + Timespan: payload$.Timespan, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getResourcesStatistics", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetResourcesStatisticsResponse, + | models.GetResourcesStatisticsStatisticsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetResourcesStatisticsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetResourcesStatisticsStatisticsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/statisticsGetStatistics.ts b/src/funcs/statisticsGetStatistics.ts new file mode 100644 index 00000000..972dbee5 --- /dev/null +++ b/src/funcs/statisticsGetStatistics.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get Media Statistics + * + * @remarks + * This will return the media statistics for the server + */ +export async function statisticsGetStatistics( + client$: PlexAPICore, + timespan?: number | undefined, + options?: RequestOptions +): Promise< + Result< + models.GetStatisticsResponse, + | models.GetStatisticsStatisticsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.GetStatisticsRequest = { + timespan: timespan, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetStatisticsRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/statistics/media")(); + + const query$ = encodeFormQuery$({ + Timespan: payload$.Timespan, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getStatistics", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetStatisticsResponse, + | models.GetStatisticsStatisticsResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetStatisticsResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetStatisticsStatisticsResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/updaterApplyUpdates.ts b/src/funcs/updaterApplyUpdates.ts new file mode 100644 index 00000000..3ca481a0 --- /dev/null +++ b/src/funcs/updaterApplyUpdates.ts @@ -0,0 +1,141 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Apply Updates + * + * @remarks + * Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed + * + */ +export async function updaterApplyUpdates( + client$: PlexAPICore, + tonight?: models.Tonight | undefined, + skip?: models.Skip | undefined, + options?: RequestOptions +): Promise< + Result< + models.ApplyUpdatesResponse, + | models.ApplyUpdatesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.ApplyUpdatesRequest = { + tonight: tonight, + skip: skip, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.ApplyUpdatesRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/updater/apply")(); + + const query$ = encodeFormQuery$({ + skip: payload$.skip, + tonight: payload$.tonight, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "applyUpdates", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "PUT", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "500", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.ApplyUpdatesResponse, + | models.ApplyUpdatesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.ApplyUpdatesResponse$inboundSchema), + m$.fail([400, "4XX", 500, "5XX"]), + m$.jsonErr(401, models.ApplyUpdatesResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/updaterCheckForUpdates.ts b/src/funcs/updaterCheckForUpdates.ts new file mode 100644 index 00000000..491f61c3 --- /dev/null +++ b/src/funcs/updaterCheckForUpdates.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Checking for updates + * + * @remarks + * Checking for updates + */ +export async function updaterCheckForUpdates( + client$: PlexAPICore, + download?: models.Download | undefined, + options?: RequestOptions +): Promise< + Result< + models.CheckForUpdatesResponse, + | models.CheckForUpdatesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.CheckForUpdatesRequest = { + download: download, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.CheckForUpdatesRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/updater/check")(); + + const query$ = encodeFormQuery$({ + download: payload$.download, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "checkForUpdates", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "PUT", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.CheckForUpdatesResponse, + | models.CheckForUpdatesResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.CheckForUpdatesResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.CheckForUpdatesResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/updaterGetUpdateStatus.ts b/src/funcs/updaterGetUpdateStatus.ts new file mode 100644 index 00000000..ac2bcaad --- /dev/null +++ b/src/funcs/updaterGetUpdateStatus.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import * as m$ from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Querying status of updates + * + * @remarks + * Querying status of updates + */ +export async function updaterGetUpdateStatus( + client$: PlexAPICore, + options?: RequestOptions +): Promise< + Result< + models.GetUpdateStatusResponse, + | models.GetUpdateStatusUpdaterResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path$ = pathToFunc("/updater/status")(); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getUpdateStatus", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetUpdateStatusResponse, + | models.GetUpdateStatusUpdaterResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetUpdateStatusResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetUpdateStatusUpdaterResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/userPostUsersSigninData.ts b/src/funcs/userPostUsersSigninData.ts new file mode 100644 index 00000000..88a97f49 --- /dev/null +++ b/src/funcs/userPostUsersSigninData.ts @@ -0,0 +1,148 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeBodyForm as encodeBodyForm$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { PostUsersSigninDataOpServerList } from "../models/postuserssignindataop.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get User SignIn Data + * + * @remarks + * Sign in user with username and password and return user data with Plex authentication token + */ +export async function userPostUsersSigninData( + client$: PlexAPICore, + xPlexClientIdentifier?: string | undefined, + requestBody?: models.PostUsersSigninDataRequestBody | undefined, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.PostUsersSigninDataResponse, + | models.PostUsersSigninDataResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$: models.PostUsersSigninDataRequest = { + xPlexClientIdentifier: xPlexClientIdentifier, + requestBody: requestBody, + }; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.PostUsersSigninDataRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = Object.entries(payload$.RequestBody || {}) + .map(([k, v]) => { + return encodeBodyForm$(k, v, { charEncoding: "percent" }); + }) + .join("&"); + + const baseURL$ = + options?.serverURL || + pathToFunc(PostUsersSigninDataOpServerList[0], { charEncoding: "percent" })(); + + const path$ = pathToFunc("/users/signin")(); + + const headers$ = new Headers({ + "Content-Type": "application/x-www-form-urlencoded", + Accept: "application/json", + "X-Plex-Client-Identifier": encodeSimple$( + "X-Plex-Client-Identifier", + payload$["X-Plex-Client-Identifier"] ?? client$.options$.xPlexClientIdentifier, + { explode: false, charEncoding: "none" } + ), + }); + + const context = { + operationID: "post-users-signin-data", + oAuth2Scopes: [], + securitySource: null, + }; + + const requestRes = client$.createRequest$( + context, + { + method: "POST", + baseURL: baseURL$, + path: path$, + headers: headers$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.PostUsersSigninDataResponse, + | models.PostUsersSigninDataResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(201, models.PostUsersSigninDataResponse$inboundSchema, { key: "UserPlexAccount" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.PostUsersSigninDataResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/videoGetTimeline.ts b/src/funcs/videoGetTimeline.ts new file mode 100644 index 00000000..38f6ad0b --- /dev/null +++ b/src/funcs/videoGetTimeline.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get the timeline for a media item + * + * @remarks + * Get the timeline for a media item + */ +export async function videoGetTimeline( + client$: PlexAPICore, + request: models.GetTimelineRequest, + options?: RequestOptions +): Promise< + Result< + models.GetTimelineResponse, + | models.GetTimelineResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$ = request; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetTimelineRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/:/timeline")(); + + const query$ = encodeFormQuery$({ + context: payload$.context, + duration: payload$.duration, + hasMDE: payload$.hasMDE, + key: payload$.key, + playBackTime: payload$.playBackTime, + playQueueItemID: payload$.playQueueItemID, + ratingKey: payload$.ratingKey, + row: payload$.row, + state: payload$.state, + time: payload$.time, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getTimeline", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetTimelineResponse, + | models.GetTimelineResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.GetTimelineResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetTimelineResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/videoStartUniversalTranscode.ts b/src/funcs/videoStartUniversalTranscode.ts new file mode 100644 index 00000000..151929e6 --- /dev/null +++ b/src/funcs/videoStartUniversalTranscode.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Start Universal Transcode + * + * @remarks + * Begin a Universal Transcode Session + */ +export async function videoStartUniversalTranscode( + client$: PlexAPICore, + request: models.StartUniversalTranscodeRequest, + options?: RequestOptions +): Promise< + Result< + models.StartUniversalTranscodeResponse, + | models.StartUniversalTranscodeResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$ = request; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.StartUniversalTranscodeRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const path$ = pathToFunc("/video/:/transcode/universal/start.mpd")(); + + const query$ = encodeFormQuery$({ + addDebugOverlay: payload$.addDebugOverlay, + audioBoost: payload$.audioBoost, + autoAdjustQuality: payload$.autoAdjustQuality, + directPlay: payload$.directPlay, + directStream: payload$.directStream, + fastSeek: payload$.fastSeek, + hasMDE: payload$.hasMDE, + location: payload$.location, + mediaBufferSize: payload$.mediaBufferSize, + mediaIndex: payload$.mediaIndex, + partIndex: payload$.partIndex, + path: payload$.path, + protocol: payload$.protocol, + session: payload$.session, + subtites: payload$.subtites, + subtitleSize: payload$.subtitleSize, + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "startUniversalTranscode", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.StartUniversalTranscodeResponse, + | models.StartUniversalTranscodeResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.nil(200, models.StartUniversalTranscodeResponse$inboundSchema), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.StartUniversalTranscodeResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/funcs/watchlistGetWatchlist.ts b/src/funcs/watchlistGetWatchlist.ts new file mode 100644 index 00000000..2425a1af --- /dev/null +++ b/src/funcs/watchlistGetWatchlist.ts @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { PlexAPICore } from "../core.js"; +import { + encodeFormQuery as encodeFormQuery$, + encodeSimple as encodeSimple$, +} from "../lib/encodings.js"; +import * as m$ from "../lib/matchers.js"; +import * as schemas$ from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { GetWatchlistOpServerList } from "../models/getwatchlistop.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import * as models from "../models/index.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +/** + * Get User Watchlist + * + * @remarks + * Get User Watchlist + */ +export async function watchlistGetWatchlist( + client$: PlexAPICore, + request: models.GetWatchlistRequest, + options?: RequestOptions & { serverURL?: string } +): Promise< + Result< + models.GetWatchlistResponse, + | models.GetWatchlistWatchlistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input$ = request; + + const parsed$ = schemas$.safeParse( + input$, + (value$) => models.GetWatchlistRequest$outboundSchema.parse(value$), + "Input validation failed" + ); + if (!parsed$.ok) { + return parsed$; + } + const payload$ = parsed$.value; + const body$ = null; + + const baseURL$ = + options?.serverURL || + pathToFunc(GetWatchlistOpServerList[0], { charEncoding: "percent" })(); + + const pathParams$ = { + filter: encodeSimple$("filter", payload$.filter, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = pathToFunc("/library/sections/watchlist/{filter}")(pathParams$); + + const query$ = encodeFormQuery$({ + includeCollections: payload$.includeCollections, + includeExternalMedia: payload$.includeExternalMedia, + libtype: payload$.libtype, + maxresults: payload$.maxresults, + sort: payload$.sort, + "X-Plex-Container-Size": payload$["X-Plex-Container-Size"], + "X-Plex-Container-Start": payload$["X-Plex-Container-Start"], + "X-Plex-Token": payload$["X-Plex-Token"], + }); + + const headers$ = new Headers({ + Accept: "application/json", + }); + + const accessToken$ = await extractSecurity(client$.options$.accessToken); + const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ }; + const context = { + operationID: "getWatchlist", + oAuth2Scopes: [], + securitySource: client$.options$.accessToken, + }; + const securitySettings$ = resolveGlobalSecurity(security$); + + const requestRes = client$.createRequest$( + context, + { + security: securitySettings$, + method: "GET", + baseURL: baseURL$, + path: path$, + headers: headers$, + query: query$, + body: body$, + timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1, + }, + options + ); + if (!requestRes.ok) { + return requestRes; + } + const request$ = requestRes.value; + + const doResult = await client$.do$(request$, { + context, + errorCodes: ["400", "401", "4XX", "5XX"], + retryConfig: options?.retries || client$.options$.retryConfig, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + Headers: {}, + }; + + const [result$] = await m$.match< + models.GetWatchlistResponse, + | models.GetWatchlistWatchlistResponseBody + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + m$.json(200, models.GetWatchlistResponse$inboundSchema, { key: "object" }), + m$.fail([400, "4XX", "5XX"]), + m$.jsonErr(401, models.GetWatchlistWatchlistResponseBody$inboundSchema) + )(response, { extraFields: responseFields$ }); + if (!result$.ok) { + return result$; + } + + return result$; +} diff --git a/src/hooks/hooks.ts b/src/hooks/hooks.ts index 6a1e31e0..a6b6e17a 100644 --- a/src/hooks/hooks.ts +++ b/src/hooks/hooks.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { RequestInput } from "../lib/http.js"; diff --git a/src/hooks/index.ts b/src/hooks/index.ts index d5fdd742..8f0e4dbf 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export * from "./types.js"; diff --git a/src/hooks/types.ts b/src/hooks/types.ts index dd23b024..3a31914a 100644 --- a/src/hooks/types.ts +++ b/src/hooks/types.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { HTTPClient, RequestInput } from "../lib/http.js"; diff --git a/src/index.ts b/src/index.ts index 24725c46..5c956a8a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export * from "./sdk/sdk.js"; diff --git a/src/lib/base64.ts b/src/lib/base64.ts index cda07641..c2d5b389 100644 --- a/src/lib/base64.ts +++ b/src/lib/base64.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; diff --git a/src/lib/config.ts b/src/lib/config.ts index 387a8344..2fcd36df 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -1,8 +1,10 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +import { ClosedEnum } from "../types/enums.js"; import { HTTPClient } from "./http.js"; +import { Logger } from "./logger.js"; import { RetryConfig } from "./retries.js"; import { Params, pathToFunc } from "./url.js"; @@ -16,10 +18,11 @@ export const ServerList = [ "{protocol}://{ip}:{port}", ] as const; -export enum ServerProtocol { - Http = "http", - Https = "https", -} +export const ServerProtocol = { + Http: "http", + Https: "https", +} as const; +export type ServerProtocol = ClosedEnum; export type SDKOptions = { accessToken?: string | (() => Promise); @@ -35,15 +38,15 @@ export type SDKOptions = { */ serverIdx?: number; /** - * Allows setting the protocol variable for url substitution + * Sets the protocol variable for url substitution */ protocol?: ServerProtocol; /** - * Allows setting the ip variable for url substitution + * Sets the ip variable for url substitution */ ip?: string; /** - * Allows setting the port variable for url substitution + * Sets the port variable for url substitution */ port?: string; /** @@ -54,6 +57,8 @@ export type SDKOptions = { * Allows overriding the default retry config used by the SDK */ retryConfig?: RetryConfig; + timeoutMs?: number; + debugLogger?: Logger; }; export function serverURLFromOptions(options: SDKOptions): URL | null { @@ -84,7 +89,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "0.0.3", - sdkVersion: "0.18.2", - genVersion: "2.356.0", - userAgent: "speakeasy-sdk/typescript 0.18.2 2.356.0 0.0.3 @lukehagar/plexjs", + sdkVersion: "0.19.0", + genVersion: "2.404.1", + userAgent: "speakeasy-sdk/typescript 0.19.0 2.404.1 0.0.3 @lukehagar/plexjs", } as const; diff --git a/src/lib/dlv.ts b/src/lib/dlv.ts new file mode 100644 index 00000000..e81091f5 --- /dev/null +++ b/src/lib/dlv.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/* +MIT License + +Copyright (c) 2024 Jason Miller (http://jasonformat.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/** + * @param obj The object to walk + * @param key The key path to walk the object with + * @param def A default value to return if the result is undefined + * + * @example + * dlv(obj, "a.b.c.d") + * @example + * dlv(object, ["a", "b", "c", "d"]) + * @example + * dlv(object, "foo.bar.baz", "Hello, default value!") + */ +export function dlv( + obj: any, + key: string | string[], + def?: T, + p?: number, + undef?: never, +): T | undefined { + key = Array.isArray(key) ? key : key.split("."); + for (p = 0; p < key.length; p++) { + const k = key[p]; + obj = k != null && obj ? obj[k] : undef; + } + return obj === undef ? def : obj; +} diff --git a/src/lib/encodings.ts b/src/lib/encodings.ts index 49f536b6..44fa7284 100644 --- a/src/lib/encodings.ts +++ b/src/lib/encodings.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { bytesToBase64 } from "./base64.js"; @@ -212,6 +212,24 @@ export function encodeDeepObject( return ""; } + if (!isPlainObject(value)) { + throw new EncodingError( + `Value of parameter '${key}' which uses deepObject encoding must be an object`, + ); + } + + return encodeDeepObjectObject(key, value, options); +} + +export function encodeDeepObjectObject( + key: string, + value: unknown, + options?: { charEncoding?: "percent" | "none" }, +): string { + if (value == null) { + return ""; + } + let out = ""; const encodeString = (v: string) => { @@ -219,9 +237,7 @@ export function encodeDeepObject( }; if (!isPlainObject(value)) { - throw new EncodingError( - `Value of parameter '${key}' which uses deepObject encoding must be an object`, - ); + throw new EncodingError(`Expected parameter '${key}' to be an object.`); } Object.entries(value).forEach(([ck, cv]) => { @@ -232,9 +248,11 @@ export function encodeDeepObject( const pk = `${key}[${ck}]`; if (isPlainObject(cv)) { - throw new EncodingError( - `Value of parameter field '${pk}' cannot be an array or object.`, - ); + const objOut = encodeDeepObjectObject(pk, cv, options); + + out += `&${objOut}`; + + return; } const pairs: unknown[] = Array.isArray(cv) ? cv : [cv]; diff --git a/src/lib/http.ts b/src/lib/http.ts index 27b8aa50..13cf1fd7 100644 --- a/src/lib/http.ts +++ b/src/lib/http.ts @@ -1,41 +1,39 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { never as znever } from "zod"; -import { parse } from "./schemas.js"; -import { isPlainObject } from "./is-plain-object.js"; -import { SDKError } from "../models/sdkerror.js"; - -export type Fetcher = (input: RequestInfo | URL, init?: RequestInit) => Promise; +export type Fetcher = ( + input: RequestInfo | URL, + init?: RequestInit, +) => Promise; export type Awaitable = T | Promise; const DEFAULT_FETCHER: Fetcher = (input, init) => { - // If input is a Request and init is undefined, Bun will discard the method, - // headers, body and other options that were set on the request object. - // Node.js and browers would ignore an undefined init value. This check is - // therefore needed for interop with Bun. - if (init == null) { - return fetch(input); - } else { - return fetch(input, init); - } + // If input is a Request and init is undefined, Bun will discard the method, + // headers, body and other options that were set on the request object. + // Node.js and browers would ignore an undefined init value. This check is + // therefore needed for interop with Bun. + if (init == null) { + return fetch(input); + } else { + return fetch(input, init); + } }; export type RequestInput = { - /** - * The URL the request will use. - */ - url: URL; - /** - * Options used to create a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). - */ - options?: RequestInit | undefined; + /** + * The URL the request will use. + */ + url: URL; + /** + * Options used to create a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). + */ + options?: RequestInit | undefined; }; export interface HTTPClientOptions { - fetcher?: Fetcher; + fetcher?: Fetcher; } export type BeforeRequestHook = (req: Request) => Awaitable; @@ -43,114 +41,114 @@ export type RequestErrorHook = (err: unknown, req: Request) => Awaitable; export type ResponseHook = (res: Response, req: Request) => Awaitable; export class HTTPClient { - private fetcher: Fetcher; - private requestHooks: BeforeRequestHook[] = []; - private requestErrorHooks: RequestErrorHook[] = []; - private responseHooks: ResponseHook[] = []; + private fetcher: Fetcher; + private requestHooks: BeforeRequestHook[] = []; + private requestErrorHooks: RequestErrorHook[] = []; + private responseHooks: ResponseHook[] = []; - constructor(private options: HTTPClientOptions = {}) { - this.fetcher = options.fetcher || DEFAULT_FETCHER; + constructor(private options: HTTPClientOptions = {}) { + this.fetcher = options.fetcher || DEFAULT_FETCHER; + } + + async request(request: Request): Promise { + let req = request; + for (const hook of this.requestHooks) { + const nextRequest = await hook(req); + if (nextRequest) { + req = nextRequest; + } } - async request(request: Request): Promise { - let req = request; - for (const hook of this.requestHooks) { - const nextRequest = await hook(req); - if (nextRequest) { - req = nextRequest; - } - } + try { + const res = await this.fetcher(req); - try { - const res = await this.fetcher(req); + for (const hook of this.responseHooks) { + await hook(res, req); + } - for (const hook of this.responseHooks) { - await hook(res, req); - } + return res; + } catch (err) { + for (const hook of this.requestErrorHooks) { + await hook(err, req); + } - return res; - } catch (err) { - for (const hook of this.requestErrorHooks) { - await hook(err, req); - } + throw err; + } + } - throw err; - } + /** + * Registers a hook that is called before a request is made. The hook function + * can mutate the request or return a new request. This may be useful to add + * additional information to request such as request IDs and tracing headers. + */ + addHook(hook: "beforeRequest", fn: BeforeRequestHook): this; + /** + * Registers a hook that is called when a request cannot be made due to a + * network error. + */ + addHook(hook: "requestError", fn: RequestErrorHook): this; + /** + * Registers a hook that is called when a response has been received from the + * server. + */ + addHook(hook: "response", fn: ResponseHook): this; + addHook( + ...args: + | [hook: "beforeRequest", fn: BeforeRequestHook] + | [hook: "requestError", fn: RequestErrorHook] + | [hook: "response", fn: ResponseHook] + ) { + if (args[0] === "beforeRequest") { + this.requestHooks.push(args[1]); + } else if (args[0] === "requestError") { + this.requestErrorHooks.push(args[1]); + } else if (args[0] === "response") { + this.responseHooks.push(args[1]); + } else { + throw new Error(`Invalid hook type: ${args[0]}`); + } + return this; + } + + /** Removes a hook that was previously registered with `addHook`. */ + removeHook(hook: "beforeRequest", fn: BeforeRequestHook): this; + /** Removes a hook that was previously registered with `addHook`. */ + removeHook(hook: "requestError", fn: RequestErrorHook): this; + /** Removes a hook that was previously registered with `addHook`. */ + removeHook(hook: "response", fn: ResponseHook): this; + removeHook( + ...args: + | [hook: "beforeRequest", fn: BeforeRequestHook] + | [hook: "requestError", fn: RequestErrorHook] + | [hook: "response", fn: ResponseHook] + ): this { + let target: unknown[]; + if (args[0] === "beforeRequest") { + target = this.requestHooks; + } else if (args[0] === "requestError") { + target = this.requestErrorHooks; + } else if (args[0] === "response") { + target = this.responseHooks; + } else { + throw new Error(`Invalid hook type: ${args[0]}`); } - /** - * Registers a hook that is called before a request is made. The hook function - * can mutate the request or return a new request. This may be useful to add - * additional information to request such as request IDs and tracing headers. - */ - addHook(hook: "beforeRequest", fn: BeforeRequestHook): this; - /** - * Registers a hook that is called when a request cannot be made due to a - * network error. - */ - addHook(hook: "requestError", fn: RequestErrorHook): this; - /** - * Registers a hook that is called when a response has been received from the - * server. - */ - addHook(hook: "response", fn: ResponseHook): this; - addHook( - ...args: - | [hook: "beforeRequest", fn: BeforeRequestHook] - | [hook: "requestError", fn: RequestErrorHook] - | [hook: "response", fn: ResponseHook] - ) { - if (args[0] === "beforeRequest") { - this.requestHooks.push(args[1]); - } else if (args[0] === "requestError") { - this.requestErrorHooks.push(args[1]); - } else if (args[0] === "response") { - this.responseHooks.push(args[1]); - } else { - throw new Error(`Invalid hook type: ${args[0]}`); - } - return this; + const index = target.findIndex((v) => v === args[1]); + if (index >= 0) { + target.splice(index, 1); } - /** Removes a hook that was previously registered with `addHook`. */ - removeHook(hook: "beforeRequest", fn: BeforeRequestHook): this; - /** Removes a hook that was previously registered with `addHook`. */ - removeHook(hook: "requestError", fn: RequestErrorHook): this; - /** Removes a hook that was previously registered with `addHook`. */ - removeHook(hook: "response", fn: ResponseHook): this; - removeHook( - ...args: - | [hook: "beforeRequest", fn: BeforeRequestHook] - | [hook: "requestError", fn: RequestErrorHook] - | [hook: "response", fn: ResponseHook] - ): this { - let target: unknown[]; - if (args[0] === "beforeRequest") { - target = this.requestHooks; - } else if (args[0] === "requestError") { - target = this.requestErrorHooks; - } else if (args[0] === "response") { - target = this.responseHooks; - } else { - throw new Error(`Invalid hook type: ${args[0]}`); - } + return this; + } - const index = target.findIndex((v) => v === args[1]); - if (index >= 0) { - target.splice(index, 1); - } + clone(): HTTPClient { + const child = new HTTPClient(this.options); + child.requestHooks = this.requestHooks.slice(); + child.requestErrorHooks = this.requestErrorHooks.slice(); + child.responseHooks = this.responseHooks.slice(); - return this; - } - - clone(): HTTPClient { - const child = new HTTPClient(this.options); - child.requestHooks = this.requestHooks.slice(); - child.requestErrorHooks = this.requestErrorHooks.slice(); - child.responseHooks = this.responseHooks.slice(); - - return child; - } + return child; + } } export type StatusCodePredicate = number | string | (number | string)[]; @@ -159,343 +157,167 @@ export type StatusCodePredicate = number | string | (number | string)[]; // segments in a media type string. const mediaParamSeparator = /\s*;\s*/g; -function matchContentType(response: Response, pattern: string): boolean { - // `*` is a special case which means anything is acceptable. - if (pattern === "*") { - return true; - } - - let contentType = response.headers.get("content-type")?.trim() || "application/octet-stream"; - contentType = contentType.toLowerCase(); - - const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator); - const [wantType = "", ...wantParams] = wantParts; - - if (wantType.split("/").length !== 2) { - return false; - } - - const gotParts = contentType.split(mediaParamSeparator); - const [gotType = "", ...gotParams] = gotParts; - - const [type = "", subtype = ""] = gotType.split("/"); - if (!type || !subtype) { - return false; - } - - if ( - wantType !== "*/*" && - gotType !== wantType && - `${type}/*` !== wantType && - `*/${subtype}` !== wantType - ) { - return false; - } - - if (gotParams.length < wantParams.length) { - return false; - } - - const params = new Set(gotParams); - for (const wantParam of wantParams) { - if (!params.has(wantParam)) { - return false; - } - } - +export function matchContentType(response: Response, pattern: string): boolean { + // `*` is a special case which means anything is acceptable. + if (pattern === "*") { return true; + } + + let contentType = + response.headers.get("content-type")?.trim() || "application/octet-stream"; + contentType = contentType.toLowerCase(); + + const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator); + const [wantType = "", ...wantParams] = wantParts; + + if (wantType.split("/").length !== 2) { + return false; + } + + const gotParts = contentType.split(mediaParamSeparator); + const [gotType = "", ...gotParams] = gotParts; + + const [type = "", subtype = ""] = gotType.split("/"); + if (!type || !subtype) { + return false; + } + + if ( + wantType !== "*/*" && + gotType !== wantType && + `${type}/*` !== wantType && + `*/${subtype}` !== wantType + ) { + return false; + } + + if (gotParams.length < wantParams.length) { + return false; + } + + const params = new Set(gotParams); + for (const wantParam of wantParams) { + if (!params.has(wantParam)) { + return false; + } + } + + return true; } const codeRangeRE = new RegExp("^[0-9]xx$", "i"); -export function matchStatusCode(response: Response, codes: StatusCodePredicate): boolean { - const actual = `${response.status}`; - const expectedCodes = Array.isArray(codes) ? codes : [codes]; - if (!expectedCodes.length) { - return false; +export function matchStatusCode( + response: Response, + codes: StatusCodePredicate, +): boolean { + const actual = `${response.status}`; + const expectedCodes = Array.isArray(codes) ? codes : [codes]; + if (!expectedCodes.length) { + return false; + } + + return expectedCodes.some((ec) => { + const code = `${ec}`; + + if (code === "default") { + return true; } - return expectedCodes.some((ec) => { - const code = `${ec}`; + if (!codeRangeRE.test(`${code}`)) { + return code === actual; + } - if (code === "default") { - return true; - } + const expectFamily = code.charAt(0); + if (!expectFamily) { + throw new Error("Invalid status code range"); + } - if (!codeRangeRE.test(`${code}`)) { - return code === actual; - } + const actualFamily = actual.charAt(0); + if (!actualFamily) { + throw new Error(`Invalid response status code: ${actual}`); + } - const expectFamily = code.charAt(0); - if (!expectFamily) { - throw new Error("Invalid status code range"); - } - - const actualFamily = actual.charAt(0); - if (!actualFamily) { - throw new Error(`Invalid response status code: ${actual}`); - } - - return actualFamily === expectFamily; - }); + return actualFamily === expectFamily; + }); } export function matchResponse( - response: Response, - code: StatusCodePredicate, - contentTypePattern: string + response: Response, + code: StatusCodePredicate, + contentTypePattern: string, ): boolean { - return matchStatusCode(response, code) && matchContentType(response, contentTypePattern); -} - -const headerValRE = /, */; -export function unpackHeaders(headers: Headers): Record { - const out: Record = {}; - - for (const [k, v] of headers.entries()) { - out[k] = v.split(headerValRE); - } - - return out; -} - -type ResponseMatcherSchema = - | { parse: (data: unknown) => T } - | { inboundSchema: { parse: (data: unknown) => T } }; - -type SerializationMethod = "sse" | "json" | "rawBytes" | "rawStream" | "text" | "void" | "fail"; - -const defaultContentTypes: Record = { - sse: "text/event-stream", - json: "application/json", - rawBytes: "application/octet-stream", - rawStream: "application/octet-stream", - text: "text/plain", - void: "", - fail: "", -}; - -type ResponsePredicateMatch = { - method: SerializationMethod; - codes: StatusCodePredicate; - ctype: string; - schema: ResponseMatcherSchema; - hdrs: boolean; - key: string | undefined; - err: boolean; - fail: boolean; -}; - -type ResponsePredicateOptions = { - /** Content type to match on. */ - ctype?: string; - /** Pass HTTP headers to deserializer. */ - hdrs?: boolean; -} & ( - | { - /** The result key to store the deserialized value into. */ - key?: string; - fail?: never; - err?: never; - } - | { - /** Indicates the matched response must throw the built-in error. */ - fail: true; - key?: never; - err?: never; - } - | { - /** Indicates the matched response is a custom error. */ - err: true; - key?: never; - fail?: never; - } -); - -export class ResponseMatcher { - private predicates: ResponsePredicateMatch[] = []; - - #any( - method: SerializationMethod, - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: ResponsePredicateOptions - ) { - const ctype = opts?.ctype || defaultContentTypes[method]; - const hdrs = !!opts?.hdrs; - const key = opts?.key; - const err = !!opts?.err; - const fail = !!opts?.fail; - this.predicates.push({ - method, - codes, - ctype, - schema, - hdrs, - key, - err, - fail, - }); - return this; - } - - json( - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: ResponsePredicateOptions - ): this { - return this.#any("json", codes, schema, opts); - } - bytes( - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: ResponsePredicateOptions - ): this { - return this.#any("rawBytes", codes, schema, opts); - } - stream( - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: ResponsePredicateOptions - ): this { - return this.#any("rawStream", codes, schema, opts); - } - text( - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: ResponsePredicateOptions - ): this { - return this.#any("text", codes, schema, opts); - } - sse( - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: Omit - ): this { - return this.#any("sse", codes, schema, opts); - } - void( - codes: StatusCodePredicate, - schema: ResponseMatcherSchema, - opts?: Pick - ): this { - return this.#any("void", codes, schema, opts); - } - fail(codes: StatusCodePredicate): this { - return this.#any("fail", codes, znever(), { fail: true }); - } - - async match( - response: Response, - // envelope - options?: { - resultKey?: string; - extraFields?: Record; - } - ): Promise<[result: Result, rawData: unknown]> { - let pred: ResponsePredicateMatch | undefined; - for (const predicate of this.predicates) { - const { codes, ctype } = predicate; - if (ctype && matchResponse(response, codes, ctype)) { - pred = predicate; - break; - } else if (!ctype && matchStatusCode(response, codes)) { - pred = predicate; - break; - } - } - if (pred == null) { - const responseBody = await response.text(); - throw new SDKError( - "Unexpected API response status or content-type", - response, - responseBody - ); - } - - const { method, schema } = pred; - - let raw: unknown; - switch (method) { - case "json": - raw = await response.json(); - break; - case "rawBytes": - raw = await response.arrayBuffer(); - break; - case "rawStream": - raw = response.body; - break; - case "text": - raw = await response.text(); - break; - case "sse": - raw = response.body; - break; - case "void": - raw = await discardResponseBody(response); - break; - case "fail": - raw = await response.text(); - break; - default: - method satisfies never; - throw new Error(`Unsupported response type: ${method}`); - } - - const resultKey = pred.key || options?.resultKey; - let data: unknown; - if (pred.fail) { - throw new SDKError("API error occurred", response, typeof raw === "string" ? raw : ""); - } else if (pred.err) { - data = { - ...options?.extraFields, - ...(pred.hdrs ? { Headers: unpackHeaders(response.headers) } : null), - ...(isPlainObject(raw) ? raw : null), - }; - } else if (resultKey) { - data = { - ...options?.extraFields, - ...(pred.hdrs ? { Headers: unpackHeaders(response.headers) } : null), - [resultKey]: raw, - }; - } else { - data = { - ...options?.extraFields, - ...(pred.hdrs ? { Headers: unpackHeaders(response.headers) } : null), - }; - } - - const parser = "inboundSchema" in schema ? schema.inboundSchema : schema; - const body = parse(data, (v: unknown) => parser.parse(v), "Response validation failed"); - - if (body instanceof Error) { - throw body; - } - - return [body, raw]; - } + return ( + matchStatusCode(response, code) && + matchContentType(response, contentTypePattern) + ); } /** - * Discards the response body to free up resources. - * - * To learn why this is need, see the undici docs: - * https://undici.nodejs.org/#/?id=garbage-collection + * Uses various heurisitics to determine if an error is a connection error. */ -export async function discardResponseBody(res: Response) { - const reader = res.body?.getReader(); - if (reader == null) { - return; - } +export function isConnectionError(err: unknown): boolean { + if (typeof err !== "object" || err == null) { + return false; + } - try { - let done = false; - while (!done) { - const res = await reader.read(); - done = res.done; - } - } finally { - reader.releaseLock(); - } + // Covers fetch in Deno as well + const isBrowserErr = + err instanceof TypeError && + err.message.toLowerCase().startsWith("failed to fetch"); + + const isNodeErr = + err instanceof TypeError && + err.message.toLowerCase().startsWith("fetch failed"); + + const isBunErr = "name" in err && err.name === "ConnectionError"; + + const isGenericErr = + "code" in err && + typeof err.code === "string" && + err.code.toLowerCase() === "econnreset"; + + return isBrowserErr || isNodeErr || isGenericErr || isBunErr; +} + +/** + * Uses various heurisitics to determine if an error is a timeout error. + */ +export function isTimeoutError(err: unknown): boolean { + if (typeof err !== "object" || err == null) { + return false; + } + + // Fetch in browser, Node.js, Bun, Deno + const isNative = "name" in err && err.name === "TimeoutError"; + const isLegacyNative = "code" in err && err.code === 23; + + // Node.js HTTP client and Axios + const isGenericErr = + "code" in err && + typeof err.code === "string" && + err.code.toLowerCase() === "econnaborted"; + + return isNative || isLegacyNative || isGenericErr; +} + +/** + * Uses various heurisitics to determine if an error is a abort error. + */ +export function isAbortError(err: unknown): boolean { + if (typeof err !== "object" || err == null) { + return false; + } + + // Fetch in browser, Node.js, Bun, Deno + const isNative = "name" in err && err.name === "AbortError"; + const isLegacyNative = "code" in err && err.code === 20; + + // Node.js HTTP client and Axios + const isGenericErr = + "code" in err && + typeof err.code === "string" && + err.code.toLowerCase() === "econnaborted"; + + return isNative || isLegacyNative || isGenericErr; } diff --git a/src/lib/is-plain-object.ts b/src/lib/is-plain-object.ts index af0d6e7e..61070d3d 100644 --- a/src/lib/is-plain-object.ts +++ b/src/lib/is-plain-object.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ /* diff --git a/src/lib/logger.ts b/src/lib/logger.ts new file mode 100644 index 00000000..d181f293 --- /dev/null +++ b/src/lib/logger.ts @@ -0,0 +1,9 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export interface Logger { + group(label?: string): void; + groupEnd(): void; + log(message: any, ...args: any[]): void; +} diff --git a/src/lib/matchers.ts b/src/lib/matchers.ts new file mode 100644 index 00000000..0843e432 --- /dev/null +++ b/src/lib/matchers.ts @@ -0,0 +1,305 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { safeParse } from "./schemas.js"; +import { StatusCodePredicate, matchResponse, matchStatusCode } from "./http.js"; +import { isPlainObject } from "./is-plain-object.js"; +import { SDKError } from "../models/sdkerror.js"; +import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; + +export type Encoding = "json" | "text" | "bytes" | "stream" | "sse" | "nil" | "fail"; + +const DEFAULT_CONTENT_TYPES: Record = { + json: "application/json", + text: "text/plain", + bytes: "application/octet-stream", + stream: "application/octet-stream", + sse: "text/event-stream", + nil: "*", + fail: "*", +}; + +type Schema = { parse(raw: unknown): T }; + +type MatchOptions = { ctype?: string; hdrs?: boolean; key?: string; sseSentinel?: string }; + +export type ValueMatcher = MatchOptions & { + enc: Encoding; + codes: StatusCodePredicate; + schema: Schema; +}; + +export type ErrorMatcher = MatchOptions & { + enc: Encoding; + codes: StatusCodePredicate; + schema: Schema; + err: true; +}; + +export type FailMatcher = { + enc: "fail"; + codes: StatusCodePredicate; +}; + +export type Matcher = ValueMatcher | ErrorMatcher | FailMatcher; + +export function jsonErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ErrorMatcher { + return { ...options, err: true, enc: "json", codes, schema }; +} +export function json( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ValueMatcher { + return { ...options, enc: "json", codes, schema }; +} + +export function textErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ErrorMatcher { + return { ...options, err: true, enc: "text", codes, schema }; +} +export function text( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ValueMatcher { + return { ...options, enc: "text", codes, schema }; +} + +export function bytesErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ErrorMatcher { + return { ...options, err: true, enc: "bytes", codes, schema }; +} +export function bytes( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ValueMatcher { + return { ...options, enc: "bytes", codes, schema }; +} + +export function streamErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ErrorMatcher { + return { ...options, err: true, enc: "stream", codes, schema }; +} +export function stream( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ValueMatcher { + return { ...options, enc: "stream", codes, schema }; +} + +export function sseErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ErrorMatcher { + return { ...options, err: true, enc: "sse", codes, schema }; +} +export function sse( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ValueMatcher { + return { ...options, enc: "sse", codes, schema }; +} + +export function nilErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ErrorMatcher { + return { ...options, err: true, enc: "nil", codes, schema }; +} +export function nil( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions +): ValueMatcher { + return { ...options, enc: "nil", codes, schema }; +} + +export function fail(codes: StatusCodePredicate): FailMatcher { + return { enc: "fail", codes }; +} + +export type MatchedValue = Matchers extends Matcher[] ? T : never; +export type MatchedError = Matchers extends Matcher[] ? E : never; +export type MatchFunc = ( + response: Response, + options?: { resultKey?: string; extraFields?: Record } +) => Promise<[result: Result, raw: unknown]>; + +export function match( + ...matchers: Array> +): MatchFunc { + return async function matchFunc( + response: Response, + options?: { resultKey?: string; extraFields?: Record } + ): Promise<[result: Result, raw: unknown]> { + let raw: unknown; + let matcher: Matcher | undefined; + for (const match of matchers) { + const { codes } = match; + const ctpattern = "ctype" in match ? match.ctype : DEFAULT_CONTENT_TYPES[match.enc]; + if (ctpattern && matchResponse(response, codes, ctpattern)) { + matcher = match; + break; + } else if (!ctpattern && matchStatusCode(response, codes)) { + matcher = match; + break; + } + } + + if (!matcher) { + const responseBody = await response.text(); + return [ + { + ok: false, + error: new SDKError( + "Unexpected API response status or content-type", + response, + responseBody + ), + }, + responseBody, + ]; + } + + const encoding = matcher.enc; + switch (encoding) { + case "json": + raw = await response.json(); + break; + case "bytes": + raw = await response.arrayBuffer(); + break; + case "stream": + raw = response.body; + break; + case "text": + raw = await response.text(); + break; + case "sse": + raw = response.body; + break; + case "nil": + raw = await discardResponseBody(response); + break; + case "fail": + raw = await response.text(); + break; + default: + encoding satisfies never; + throw new Error(`Unsupported response type: ${encoding}`); + } + + if (matcher.enc === "fail") { + return [ + { + ok: false, + error: new SDKError( + "API error occurred", + response, + typeof raw === "string" ? raw : "" + ), + }, + raw, + ]; + } + + const resultKey = matcher.key || options?.resultKey; + let data: unknown; + + if ("err" in matcher) { + data = { + ...options?.extraFields, + ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), + ...(isPlainObject(raw) ? raw : null), + }; + } else if (resultKey) { + data = { + ...options?.extraFields, + ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), + [resultKey]: raw, + }; + } else { + data = { + ...options?.extraFields, + ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), + }; + } + + if ("err" in matcher) { + const result = safeParse( + data, + (v: unknown) => matcher.schema.parse(v), + "Response validation failed" + ); + return [result.ok ? { ok: false, error: result.value } : result, raw]; + } else { + return [ + safeParse( + data, + (v: unknown) => matcher.schema.parse(v), + "Response validation failed" + ), + raw, + ]; + } + }; +} + +const headerValRE = /, */; +/** + * Iterates over a Headers object and returns an object with all the header + * entries. Values are represented as an array to account for repeated headers. + */ +export function unpackHeaders(headers: Headers): Record { + const out: Record = {}; + + for (const [k, v] of headers.entries()) { + out[k] = v.split(headerValRE); + } + + return out; +} + +/** + * Discards the response body to free up resources. + * + * To learn why this is need, see the undici docs: + * https://undici.nodejs.org/#/?id=garbage-collection + */ +export async function discardResponseBody(res: Response) { + const reader = res.body?.getReader(); + if (reader == null) { + return; + } + + try { + let done = false; + while (!done) { + const res = await reader.read(); + done = res.done; + } + } finally { + reader.releaseLock(); + } +} diff --git a/src/lib/primitives.ts b/src/lib/primitives.ts index d3aae30b..23794a2b 100644 --- a/src/lib/primitives.ts +++ b/src/lib/primitives.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export type Remap = { diff --git a/src/lib/retries.ts b/src/lib/retries.ts index ed9b4959..df3e0bc2 100644 --- a/src/lib/retries.ts +++ b/src/lib/retries.ts @@ -1,7 +1,9 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +import { isConnectionError, isTimeoutError } from "./http.js"; + export type BackoffStrategy = { initialInterval: number; maxInterval: number; @@ -99,47 +101,6 @@ function wrapFetcher( }; } -function isConnectionError(err: unknown) { - if (typeof err !== "object" || err == null) { - return false; - } - - // Covers fetch in Deno as well - const isBrowserErr = - err instanceof TypeError && - err.message.toLowerCase().startsWith("failed to fetch"); - - const isNodeErr = - err instanceof TypeError && - err.message.toLowerCase().startsWith("fetch failed"); - - const isBunErr = "name" in err && err.name === "ConnectionError"; - - const isGenericErr = - "code" in err && - typeof err.code === "string" && - err.code.toLowerCase() === "econnreset"; - - return isBrowserErr || isNodeErr || isGenericErr || isBunErr; -} - -function isTimeoutError(err: unknown) { - if (typeof err !== "object" || err == null) { - return false; - } - - // Fetch in browser, Node.js, Bun, Deno - const isNative = "name" in err && err.name === "TimeoutError"; - - // Node.js HTTP client and Axios - const isGenericErr = - "code" in err && - typeof err.code === "string" && - err.code.toLowerCase() === "econnaborted"; - - return isNative || isGenericErr; -} - const codeRangeRE = new RegExp("^[0-9]xx$", "i"); function isRetryableResponse(res: Response, statusCodes: string[]): boolean { diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index 9437c21b..c74ac859 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -1,9 +1,10 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { output, ZodEffects, ZodError, ZodObject, ZodRawShape, ZodTypeAny } from "zod"; import { SDKValidationError } from "../models/sdkvalidationerror.js"; +import { ERR, OK, Result } from "../types/fp.js"; /** * Utility function that executes some code which may throw a ZodError. It @@ -21,6 +22,23 @@ export function parse(rawValue: Inp, fn: (value: Inp) => Out, errorMes } } +/** + * Utility function that executes some code which may result in a ZodError. It + * intercepts this error and converts it to an SDKValidationError so as to not + * leak Zod implementation details to user code. + */ +export function safeParse( + rawValue: Inp, + fn: (value: Inp) => Out, + errorMessage: string +): Result { + try { + return OK(fn(rawValue)); + } catch (err) { + return ERR(new SDKValidationError(errorMessage, err, rawValue)); + } +} + export function collectExtraKeys< Shape extends ZodRawShape, Catchall extends ZodTypeAny, diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts index b6f45cfc..bfdd54ba 100644 --- a/src/lib/sdks.ts +++ b/src/lib/sdks.ts @@ -1,16 +1,51 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { ResponseMatcher, HTTPClient, matchStatusCode } from "./http.js"; -import { SecurityState, resolveSecurity, resolveGlobalSecurity } from "./security.js"; -import { pathToFunc } from "./url.js"; +import { + HTTPClient, + matchContentType, + matchStatusCode, + isAbortError, + isTimeoutError, + isConnectionError, +} from "./http.js"; +import { SecurityState } from "./security.js"; +import { retry, RetryConfig } from "./retries.js"; +import { Logger } from "./logger.js"; import { encodeForm } from "./encodings.js"; import { stringToBase64 } from "./base64.js"; +import { SDKOptions, SDK_METADATA, serverURLFromOptions } from "./config.js"; import { SDKHooks } from "../hooks/hooks.js"; import { HookContext } from "../hooks/types.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/httpclienterrors.js"; +import { ERR, OK, Result } from "../types/fp.js"; export type RequestOptions = { + /** + * Sets a timeout, in milliseconds, on HTTP requests made by an SDK method. If + * `fetchOptions.signal` is set then it will take precedence over this option. + */ + timeoutMs?: number; + /** + * Set or override a retry policy on HTTP calls. + */ + retries?: RetryConfig; + /** + * Specifies the status codes which should be retried using the given retry policy. + */ + retryCodes?: string[]; + /** + * Sets various request options on the `fetch` call made by an SDK method. + * + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request} + */ fetchOptions?: Omit; }; @@ -22,35 +57,65 @@ type RequestConfig = { body?: RequestInit["body"]; headers?: HeadersInit; security?: SecurityState | null; + uaHeader?: string; + timeoutMs?: number; }; +const gt: unknown = typeof globalThis === "undefined" ? null : globalThis; +const webWorkerLike = + typeof gt === "object" && + gt != null && + "importScripts" in gt && + typeof gt["importScripts"] === "function"; +const isBrowserLike = + webWorkerLike || + (typeof navigator !== "undefined" && "serviceWorker" in navigator) || + (typeof window === "object" && typeof window.document !== "undefined"); + export class ClientSDK { - private readonly client: HTTPClient; + private readonly httpClient: HTTPClient; protected readonly baseURL: URL | null; protected readonly hooks$: SDKHooks; + protected readonly logger?: Logger | undefined; + public readonly options$: SDKOptions & { hooks?: SDKHooks }; - constructor(init: { client: HTTPClient; baseURL: URL | null; hooks: SDKHooks }) { - const url = init.baseURL; + constructor(options: SDKOptions = {}) { + const opt = options as unknown; + if ( + typeof opt === "object" && + opt != null && + "hooks" in opt && + opt.hooks instanceof SDKHooks + ) { + this.hooks$ = opt.hooks; + } else { + this.hooks$ = new SDKHooks(); + } + this.options$ = { ...options, hooks: this.hooks$ }; + + const url = serverURLFromOptions(options); if (url) { url.pathname = url.pathname.replace(/\/+$/, "") + "/"; } - - this.hooks$ = init.hooks; - const { baseURL, client } = this.hooks$.sdkInit({ baseURL: url, client: init.client }); + const { baseURL, client } = this.hooks$.sdkInit({ + baseURL: url, + client: options.httpClient || new HTTPClient(), + }); this.baseURL = baseURL; - this.client = client; + this.httpClient = client; + this.logger = options.debugLogger; } - protected createRequest$( + public createRequest$( context: HookContext, conf: RequestConfig, options?: RequestOptions - ): Request { + ): Result { const { method, path, query, headers: opHeaders, security } = conf; const base = conf.baseURL ?? this.baseURL; if (!base) { - throw new TypeError("No base URL provided for operation"); + return ERR(new InvalidRequestError("No base URL provided for operation")); } const reqURL = new URL(base); const inputURL = new URL(path, reqURL); @@ -100,49 +165,193 @@ export class ClientSDK { headers.set(k, v); } - const input = this.hooks$.beforeCreateRequest(context, { - url: reqURL, - options: { - ...options?.fetchOptions, - body: conf.body ?? null, - headers, - method, - }, - }); + // Only set user agent header in non-browser-like environments since CORS + // policy disallows setting it in browsers e.g. Chrome throws an error. + if (!isBrowserLike) { + headers.set(conf.uaHeader ?? "user-agent", SDK_METADATA.userAgent); + } - return new Request(input.url, input.options); + let fetchOptions = options?.fetchOptions; + if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) { + const timeoutSignal = AbortSignal.timeout(conf.timeoutMs); + if (!fetchOptions) { + fetchOptions = { signal: timeoutSignal }; + } else { + fetchOptions.signal = timeoutSignal; + } + } + + let input; + try { + input = this.hooks$.beforeCreateRequest(context, { + url: reqURL, + options: { + ...fetchOptions, + body: conf.body ?? null, + headers, + method, + }, + }); + } catch (err: unknown) { + return ERR( + new UnexpectedClientError("Create request hook failed to execute", { cause: err }) + ); + } + + return OK(new Request(input.url, input.options)); } - protected async do$( - req: Request, + public async do$( + request: Request, options: { context: HookContext; errorCodes: number | string | (number | string)[]; + retryConfig?: RetryConfig | undefined; + retryCodes?: string[] | undefined; } - ): Promise { + ): Promise< + Result< + Response, + RequestAbortedError | RequestTimeoutError | ConnectionError | UnexpectedClientError + > + > { const { context, errorCodes } = options; + const retryConfig = options.retryConfig || { strategy: "none" }; + const retryCodes = options.retryCodes || []; - let response = await this.client.request(await this.hooks$.beforeRequest(context, req)); + return retry( + async () => { + const req = await this.hooks$.beforeRequest(context, request.clone()); + await logRequest(this.logger, req).catch((e) => + this.logger?.log("Failed to log request:", e) + ); - if (matchStatusCode(response, errorCodes)) { - const result = await this.hooks$.afterError(context, response, null); - if (result.error) { - throw result.error; + let response = await this.httpClient.request(req); + + if (matchStatusCode(response, errorCodes)) { + const result = await this.hooks$.afterError(context, response, null); + if (result.error) { + throw result.error; + } + response = result.response || response; + } else { + response = await this.hooks$.afterSuccess(context, response); + } + + await logResponse(this.logger, response, req).catch((e) => + this.logger?.log("Failed to log response:", e) + ); + + return response; + }, + { config: retryConfig, statusCodes: retryCodes } + ).then( + (r) => OK(r), + (err) => { + switch (true) { + case isAbortError(err): + return ERR( + new RequestAbortedError("Request aborted by client", { cause: err }) + ); + case isTimeoutError(err): + return ERR(new RequestTimeoutError("Request timed out", { cause: err })); + case isConnectionError(err): + return ERR(new ConnectionError("Unable to make request", { cause: err })); + default: + return ERR( + new UnexpectedClientError("Unexpected HTTP client error", { + cause: err, + }) + ); + } } - response = result.response || response; - } else { - response = await this.hooks$.afterSuccess(context, response); - } - - return response; + ); } - - protected matcher(): ResponseMatcher { - return new ResponseMatcher(); - } - - protected templateURLComponent = pathToFunc; - - protected resolveSecurity = resolveSecurity; - protected resolveGlobalSecurity = resolveGlobalSecurity; +} + +const jsonLikeContentTypeRE = /^application\/(?:.{0,100}\+)?json/; +async function logRequest(logger: Logger | undefined, req: Request) { + if (!logger) { + return; + } + + const contentType = req.headers.get("content-type"); + const ct = contentType?.split(";")[0] || ""; + + logger.group(`> Request: ${req.method} ${req.url}`); + + logger.group("Headers:"); + for (const [k, v] of req.headers.entries()) { + logger.log(`${k}: ${v}`); + } + logger.groupEnd(); + + logger.group("Body:"); + switch (true) { + case jsonLikeContentTypeRE.test(ct): + logger.log(await req.clone().json()); + break; + case ct.startsWith("text/"): + logger.log(await req.clone().text()); + break; + case ct === "multipart/form-data": { + const body = await req.clone().formData(); + for (const [k, v] of body) { + const vlabel = v instanceof Blob ? "" : v; + logger.log(`${k}: ${vlabel}`); + } + break; + } + default: + logger.log(`<${contentType}>`); + break; + } + logger.groupEnd(); + + logger.groupEnd(); +} + +async function logResponse(logger: Logger | undefined, res: Response, req: Request) { + if (!logger) { + return; + } + + const contentType = res.headers.get("content-type"); + const ct = contentType?.split(";")[0] || ""; + + logger.group(`< Response: ${req.method} ${req.url}`); + logger.log("Status Code:", res.status, res.statusText); + + logger.group("Headers:"); + for (const [k, v] of res.headers.entries()) { + logger.log(`${k}: ${v}`); + } + logger.groupEnd(); + + logger.group("Body:"); + switch (true) { + case matchContentType(res, "application/json") || jsonLikeContentTypeRE.test(ct): + logger.log(await res.clone().json()); + break; + case matchContentType(res, "text/event-stream"): + logger.log(`<${contentType}>`); + break; + case matchContentType(res, "text/*"): + logger.log(await res.clone().text()); + break; + case matchContentType(res, "multipart/form-data"): { + const body = await res.clone().formData(); + for (const [k, v] of body) { + const vlabel = v instanceof Blob ? "" : v; + logger.log(`${k}: ${vlabel}`); + } + break; + } + default: + logger.log(`<${contentType}>`); + break; + } + logger.groupEnd(); + + logger.groupEnd(); } diff --git a/src/lib/security.ts b/src/lib/security.ts index 8556fa24..f7c0b434 100644 --- a/src/lib/security.ts +++ b/src/lib/security.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as models from "../models/index.js"; @@ -180,3 +180,13 @@ export function resolveGlobalSecurity( }, ]); } + +export async function extractSecurity>( + sec: T | (() => Promise) | undefined +): Promise { + if (sec == null) { + return; + } + + return typeof sec === "function" ? sec() : sec; +} diff --git a/src/lib/url.ts b/src/lib/url.ts index df58acbb..6bc6356e 100644 --- a/src/lib/url.ts +++ b/src/lib/url.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ const hasOwn = Object.prototype.hasOwnProperty; diff --git a/src/models/addplaylistcontentsop.ts b/src/models/addplaylistcontentsop.ts index 8dedc4f6..eded07b6 100644 --- a/src/models/addplaylistcontentsop.ts +++ b/src/models/addplaylistcontentsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -51,7 +51,11 @@ export class AddPlaylistContentsPlaylistsResponseBody extends Error { data$: AddPlaylistContentsPlaylistsResponseBodyData; constructor(err: AddPlaylistContentsPlaylistsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -61,11 +65,6 @@ export class AddPlaylistContentsPlaylistsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "AddPlaylistContentsPlaylistsResponseBody"; } } @@ -120,274 +119,388 @@ export type AddPlaylistContentsResponse = { }; /** @internal */ +export const AddPlaylistContentsRequest$inboundSchema: z.ZodType< + AddPlaylistContentsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistID: z.number(), + uri: z.string(), + playQueueID: z.number().optional(), +}); + +/** @internal */ +export type AddPlaylistContentsRequest$Outbound = { + playlistID: number; + uri: string; + playQueueID?: number | undefined; +}; + +/** @internal */ +export const AddPlaylistContentsRequest$outboundSchema: z.ZodType< + AddPlaylistContentsRequest$Outbound, + z.ZodTypeDef, + AddPlaylistContentsRequest +> = z.object({ + playlistID: z.number(), + uri: z.string(), + playQueueID: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace AddPlaylistContentsRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - uri: z.string(), - playQueueID: z.number().optional(), - }); - - export type Outbound = { - playlistID: number; - uri: string; - playQueueID?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - uri: z.string(), - playQueueID: z.number().optional(), - }); + /** @deprecated use `AddPlaylistContentsRequest$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsRequest$inboundSchema; + /** @deprecated use `AddPlaylistContentsRequest$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsRequest$outboundSchema; + /** @deprecated use `AddPlaylistContentsRequest$Outbound` instead. */ + export type Outbound = AddPlaylistContentsRequest$Outbound; } /** @internal */ +export const AddPlaylistContentsErrors$inboundSchema: z.ZodType< + AddPlaylistContentsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type AddPlaylistContentsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const AddPlaylistContentsErrors$outboundSchema: z.ZodType< + AddPlaylistContentsErrors$Outbound, + z.ZodTypeDef, + AddPlaylistContentsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace AddPlaylistContentsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `AddPlaylistContentsErrors$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsErrors$inboundSchema; + /** @deprecated use `AddPlaylistContentsErrors$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsErrors$outboundSchema; + /** @deprecated use `AddPlaylistContentsErrors$Outbound` instead. */ + export type Outbound = AddPlaylistContentsErrors$Outbound; } /** @internal */ -export namespace AddPlaylistContentsPlaylistsResponseBody$ { - export const inboundSchema: z.ZodType< - AddPlaylistContentsPlaylistsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => AddPlaylistContentsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new AddPlaylistContentsPlaylistsResponseBody(remapped); +export const AddPlaylistContentsPlaylistsResponseBody$inboundSchema: z.ZodType< + AddPlaylistContentsPlaylistsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => AddPlaylistContentsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - AddPlaylistContentsPlaylistsResponseBody - > = z - .instanceof(AddPlaylistContentsPlaylistsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => AddPlaylistContentsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new AddPlaylistContentsPlaylistsResponseBody(remapped); + }); /** @internal */ -export namespace AddPlaylistContentsMetadata$ { - export const inboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - type?: string | undefined; - title?: string | undefined; - summary?: string | undefined; - smart?: boolean | undefined; - playlistType?: string | undefined; - composite?: string | undefined; - duration?: number | undefined; - leafCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - }); -} +export type AddPlaylistContentsPlaylistsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace AddPlaylistContentsMediaContainer$ { - export const inboundSchema: z.ZodType< - AddPlaylistContentsMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - leafCountAdded: z.number().int().optional(), - leafCountRequested: z.number().int().optional(), - Metadata: z.array(z.lazy(() => AddPlaylistContentsMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - leafCountAdded?: number | undefined; - leafCountRequested?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - AddPlaylistContentsMediaContainer - > = z - .object({ - size: z.number().int().optional(), - leafCountAdded: z.number().int().optional(), - leafCountRequested: z.number().int().optional(), - metadata: z.array(z.lazy(() => AddPlaylistContentsMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); -} - -/** @internal */ -export namespace AddPlaylistContentsResponseBody$ { - export const inboundSchema: z.ZodType = +export const AddPlaylistContentsPlaylistsResponseBody$outboundSchema: z.ZodType< + AddPlaylistContentsPlaylistsResponseBody$Outbound, + z.ZodTypeDef, + AddPlaylistContentsPlaylistsResponseBody +> = z + .instanceof(AddPlaylistContentsPlaylistsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => AddPlaylistContentsMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => AddPlaylistContentsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: AddPlaylistContentsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - AddPlaylistContentsResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => AddPlaylistContentsMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace AddPlaylistContentsPlaylistsResponseBody$ { + /** @deprecated use `AddPlaylistContentsPlaylistsResponseBody$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsPlaylistsResponseBody$inboundSchema; + /** @deprecated use `AddPlaylistContentsPlaylistsResponseBody$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsPlaylistsResponseBody$outboundSchema; + /** @deprecated use `AddPlaylistContentsPlaylistsResponseBody$Outbound` instead. */ + export type Outbound = AddPlaylistContentsPlaylistsResponseBody$Outbound; } /** @internal */ -export namespace AddPlaylistContentsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => AddPlaylistContentsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const AddPlaylistContentsMetadata$inboundSchema: z.ZodType< + AddPlaylistContentsMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: AddPlaylistContentsResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type AddPlaylistContentsMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + type?: string | undefined; + title?: string | undefined; + summary?: string | undefined; + smart?: boolean | undefined; + playlistType?: string | undefined; + composite?: string | undefined; + duration?: number | undefined; + leafCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => AddPlaylistContentsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const AddPlaylistContentsMetadata$outboundSchema: z.ZodType< + AddPlaylistContentsMetadata$Outbound, + z.ZodTypeDef, + AddPlaylistContentsMetadata +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace AddPlaylistContentsMetadata$ { + /** @deprecated use `AddPlaylistContentsMetadata$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsMetadata$inboundSchema; + /** @deprecated use `AddPlaylistContentsMetadata$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsMetadata$outboundSchema; + /** @deprecated use `AddPlaylistContentsMetadata$Outbound` instead. */ + export type Outbound = AddPlaylistContentsMetadata$Outbound; +} + +/** @internal */ +export const AddPlaylistContentsMediaContainer$inboundSchema: z.ZodType< + AddPlaylistContentsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + leafCountAdded: z.number().int().optional(), + leafCountRequested: z.number().int().optional(), + Metadata: z.array(z.lazy(() => AddPlaylistContentsMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type AddPlaylistContentsMediaContainer$Outbound = { + size?: number | undefined; + leafCountAdded?: number | undefined; + leafCountRequested?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const AddPlaylistContentsMediaContainer$outboundSchema: z.ZodType< + AddPlaylistContentsMediaContainer$Outbound, + z.ZodTypeDef, + AddPlaylistContentsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + leafCountAdded: z.number().int().optional(), + leafCountRequested: z.number().int().optional(), + metadata: z.array(z.lazy(() => AddPlaylistContentsMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace AddPlaylistContentsMediaContainer$ { + /** @deprecated use `AddPlaylistContentsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsMediaContainer$inboundSchema; + /** @deprecated use `AddPlaylistContentsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsMediaContainer$outboundSchema; + /** @deprecated use `AddPlaylistContentsMediaContainer$Outbound` instead. */ + export type Outbound = AddPlaylistContentsMediaContainer$Outbound; +} + +/** @internal */ +export const AddPlaylistContentsResponseBody$inboundSchema: z.ZodType< + AddPlaylistContentsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => AddPlaylistContentsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type AddPlaylistContentsResponseBody$Outbound = { + MediaContainer?: AddPlaylistContentsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const AddPlaylistContentsResponseBody$outboundSchema: z.ZodType< + AddPlaylistContentsResponseBody$Outbound, + z.ZodTypeDef, + AddPlaylistContentsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => AddPlaylistContentsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace AddPlaylistContentsResponseBody$ { + /** @deprecated use `AddPlaylistContentsResponseBody$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsResponseBody$inboundSchema; + /** @deprecated use `AddPlaylistContentsResponseBody$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsResponseBody$outboundSchema; + /** @deprecated use `AddPlaylistContentsResponseBody$Outbound` instead. */ + export type Outbound = AddPlaylistContentsResponseBody$Outbound; +} + +/** @internal */ +export const AddPlaylistContentsResponse$inboundSchema: z.ZodType< + AddPlaylistContentsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => AddPlaylistContentsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type AddPlaylistContentsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: AddPlaylistContentsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const AddPlaylistContentsResponse$outboundSchema: z.ZodType< + AddPlaylistContentsResponse$Outbound, + z.ZodTypeDef, + AddPlaylistContentsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => AddPlaylistContentsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace AddPlaylistContentsResponse$ { + /** @deprecated use `AddPlaylistContentsResponse$inboundSchema` instead. */ + export const inboundSchema = AddPlaylistContentsResponse$inboundSchema; + /** @deprecated use `AddPlaylistContentsResponse$outboundSchema` instead. */ + export const outboundSchema = AddPlaylistContentsResponse$outboundSchema; + /** @deprecated use `AddPlaylistContentsResponse$Outbound` instead. */ + export type Outbound = AddPlaylistContentsResponse$Outbound; } diff --git a/src/models/applyupdatesop.ts b/src/models/applyupdatesop.ts index 6b39ebaa..7a9d3fec 100644 --- a/src/models/applyupdatesop.ts +++ b/src/models/applyupdatesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -63,7 +63,11 @@ export class ApplyUpdatesResponseBody extends Error { data$: ApplyUpdatesResponseBodyData; constructor(err: ApplyUpdatesResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -73,11 +77,6 @@ export class ApplyUpdatesResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "ApplyUpdatesResponseBody"; } } @@ -98,133 +97,239 @@ export type ApplyUpdatesResponse = { }; /** @internal */ +export const Tonight$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Tonight); + +/** @internal */ +export const Tonight$outboundSchema: z.ZodNativeEnum = Tonight$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Tonight$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Tonight); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Tonight$inboundSchema` instead. */ + export const inboundSchema = Tonight$inboundSchema; + /** @deprecated use `Tonight$outboundSchema` instead. */ + export const outboundSchema = Tonight$outboundSchema; } /** @internal */ +export const Skip$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Skip); + +/** @internal */ +export const Skip$outboundSchema: z.ZodNativeEnum = Skip$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Skip$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Skip); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Skip$inboundSchema` instead. */ + export const inboundSchema = Skip$inboundSchema; + /** @deprecated use `Skip$outboundSchema` instead. */ + export const outboundSchema = Skip$outboundSchema; } /** @internal */ +export const ApplyUpdatesRequest$inboundSchema: z.ZodType< + ApplyUpdatesRequest, + z.ZodTypeDef, + unknown +> = z.object({ + tonight: Tonight$inboundSchema.optional(), + skip: Skip$inboundSchema.optional(), +}); + +/** @internal */ +export type ApplyUpdatesRequest$Outbound = { + tonight?: number | undefined; + skip?: number | undefined; +}; + +/** @internal */ +export const ApplyUpdatesRequest$outboundSchema: z.ZodType< + ApplyUpdatesRequest$Outbound, + z.ZodTypeDef, + ApplyUpdatesRequest +> = z.object({ + tonight: Tonight$outboundSchema.optional(), + skip: Skip$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ApplyUpdatesRequest$ { - export const inboundSchema: z.ZodType = z.object({ - tonight: Tonight$.inboundSchema.optional(), - skip: Skip$.inboundSchema.optional(), - }); - - export type Outbound = { - tonight?: number | undefined; - skip?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tonight: Tonight$.outboundSchema.optional(), - skip: Skip$.outboundSchema.optional(), - }); + /** @deprecated use `ApplyUpdatesRequest$inboundSchema` instead. */ + export const inboundSchema = ApplyUpdatesRequest$inboundSchema; + /** @deprecated use `ApplyUpdatesRequest$outboundSchema` instead. */ + export const outboundSchema = ApplyUpdatesRequest$outboundSchema; + /** @deprecated use `ApplyUpdatesRequest$Outbound` instead. */ + export type Outbound = ApplyUpdatesRequest$Outbound; } /** @internal */ +export const ApplyUpdatesErrors$inboundSchema: z.ZodType< + ApplyUpdatesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type ApplyUpdatesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const ApplyUpdatesErrors$outboundSchema: z.ZodType< + ApplyUpdatesErrors$Outbound, + z.ZodTypeDef, + ApplyUpdatesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ApplyUpdatesErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `ApplyUpdatesErrors$inboundSchema` instead. */ + export const inboundSchema = ApplyUpdatesErrors$inboundSchema; + /** @deprecated use `ApplyUpdatesErrors$outboundSchema` instead. */ + export const outboundSchema = ApplyUpdatesErrors$outboundSchema; + /** @deprecated use `ApplyUpdatesErrors$Outbound` instead. */ + export type Outbound = ApplyUpdatesErrors$Outbound; } /** @internal */ +export const ApplyUpdatesResponseBody$inboundSchema: z.ZodType< + ApplyUpdatesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => ApplyUpdatesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new ApplyUpdatesResponseBody(remapped); + }); + +/** @internal */ +export type ApplyUpdatesResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const ApplyUpdatesResponseBody$outboundSchema: z.ZodType< + ApplyUpdatesResponseBody$Outbound, + z.ZodTypeDef, + ApplyUpdatesResponseBody +> = z + .instanceof(ApplyUpdatesResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => ApplyUpdatesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ApplyUpdatesResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => ApplyUpdatesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new ApplyUpdatesResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(ApplyUpdatesResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => ApplyUpdatesErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `ApplyUpdatesResponseBody$inboundSchema` instead. */ + export const inboundSchema = ApplyUpdatesResponseBody$inboundSchema; + /** @deprecated use `ApplyUpdatesResponseBody$outboundSchema` instead. */ + export const outboundSchema = ApplyUpdatesResponseBody$outboundSchema; + /** @deprecated use `ApplyUpdatesResponseBody$Outbound` instead. */ + export type Outbound = ApplyUpdatesResponseBody$Outbound; } /** @internal */ +export const ApplyUpdatesResponse$inboundSchema: z.ZodType< + ApplyUpdatesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type ApplyUpdatesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const ApplyUpdatesResponse$outboundSchema: z.ZodType< + ApplyUpdatesResponse$Outbound, + z.ZodTypeDef, + ApplyUpdatesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ApplyUpdatesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `ApplyUpdatesResponse$inboundSchema` instead. */ + export const inboundSchema = ApplyUpdatesResponse$inboundSchema; + /** @deprecated use `ApplyUpdatesResponse$outboundSchema` instead. */ + export const outboundSchema = ApplyUpdatesResponse$outboundSchema; + /** @deprecated use `ApplyUpdatesResponse$Outbound` instead. */ + export type Outbound = ApplyUpdatesResponse$Outbound; } diff --git a/src/models/cancelserveractivitiesop.ts b/src/models/cancelserveractivitiesop.ts index 1ec53b4f..5f07e967 100644 --- a/src/models/cancelserveractivitiesop.ts +++ b/src/models/cancelserveractivitiesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class CancelServerActivitiesResponseBody extends Error { data$: CancelServerActivitiesResponseBodyData; constructor(err: CancelServerActivitiesResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class CancelServerActivitiesResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "CancelServerActivitiesResponseBody"; } } @@ -78,133 +77,204 @@ export type CancelServerActivitiesResponse = { }; /** @internal */ +export const CancelServerActivitiesRequest$inboundSchema: z.ZodType< + CancelServerActivitiesRequest, + z.ZodTypeDef, + unknown +> = z.object({ + activityUUID: z.string(), +}); + +/** @internal */ +export type CancelServerActivitiesRequest$Outbound = { + activityUUID: string; +}; + +/** @internal */ +export const CancelServerActivitiesRequest$outboundSchema: z.ZodType< + CancelServerActivitiesRequest$Outbound, + z.ZodTypeDef, + CancelServerActivitiesRequest +> = z.object({ + activityUUID: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CancelServerActivitiesRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - activityUUID: z.string(), - }); - - export type Outbound = { - activityUUID: string; - }; - - export const outboundSchema: z.ZodType = - z.object({ - activityUUID: z.string(), - }); + /** @deprecated use `CancelServerActivitiesRequest$inboundSchema` instead. */ + export const inboundSchema = CancelServerActivitiesRequest$inboundSchema; + /** @deprecated use `CancelServerActivitiesRequest$outboundSchema` instead. */ + export const outboundSchema = CancelServerActivitiesRequest$outboundSchema; + /** @deprecated use `CancelServerActivitiesRequest$Outbound` instead. */ + export type Outbound = CancelServerActivitiesRequest$Outbound; } /** @internal */ +export const CancelServerActivitiesErrors$inboundSchema: z.ZodType< + CancelServerActivitiesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type CancelServerActivitiesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const CancelServerActivitiesErrors$outboundSchema: z.ZodType< + CancelServerActivitiesErrors$Outbound, + z.ZodTypeDef, + CancelServerActivitiesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CancelServerActivitiesErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `CancelServerActivitiesErrors$inboundSchema` instead. */ + export const inboundSchema = CancelServerActivitiesErrors$inboundSchema; + /** @deprecated use `CancelServerActivitiesErrors$outboundSchema` instead. */ + export const outboundSchema = CancelServerActivitiesErrors$outboundSchema; + /** @deprecated use `CancelServerActivitiesErrors$Outbound` instead. */ + export type Outbound = CancelServerActivitiesErrors$Outbound; } /** @internal */ -export namespace CancelServerActivitiesResponseBody$ { - export const inboundSchema: z.ZodType< - CancelServerActivitiesResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => CancelServerActivitiesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new CancelServerActivitiesResponseBody(remapped); +export const CancelServerActivitiesResponseBody$inboundSchema: z.ZodType< + CancelServerActivitiesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => CancelServerActivitiesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - CancelServerActivitiesResponseBody - > = z - .instanceof(CancelServerActivitiesResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => CancelServerActivitiesErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new CancelServerActivitiesResponseBody(remapped); + }); /** @internal */ -export namespace CancelServerActivitiesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export type CancelServerActivitiesResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = +/** @internal */ +export const CancelServerActivitiesResponseBody$outboundSchema: z.ZodType< + CancelServerActivitiesResponseBody$Outbound, + z.ZodTypeDef, + CancelServerActivitiesResponseBody +> = z + .instanceof(CancelServerActivitiesResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), + errors: z + .array(z.lazy(() => CancelServerActivitiesErrors$outboundSchema)) + .optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CancelServerActivitiesResponseBody$ { + /** @deprecated use `CancelServerActivitiesResponseBody$inboundSchema` instead. */ + export const inboundSchema = CancelServerActivitiesResponseBody$inboundSchema; + /** @deprecated use `CancelServerActivitiesResponseBody$outboundSchema` instead. */ + export const outboundSchema = CancelServerActivitiesResponseBody$outboundSchema; + /** @deprecated use `CancelServerActivitiesResponseBody$Outbound` instead. */ + export type Outbound = CancelServerActivitiesResponseBody$Outbound; +} + +/** @internal */ +export const CancelServerActivitiesResponse$inboundSchema: z.ZodType< + CancelServerActivitiesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type CancelServerActivitiesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const CancelServerActivitiesResponse$outboundSchema: z.ZodType< + CancelServerActivitiesResponse$Outbound, + z.ZodTypeDef, + CancelServerActivitiesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CancelServerActivitiesResponse$ { + /** @deprecated use `CancelServerActivitiesResponse$inboundSchema` instead. */ + export const inboundSchema = CancelServerActivitiesResponse$inboundSchema; + /** @deprecated use `CancelServerActivitiesResponse$outboundSchema` instead. */ + export const outboundSchema = CancelServerActivitiesResponse$outboundSchema; + /** @deprecated use `CancelServerActivitiesResponse$Outbound` instead. */ + export type Outbound = CancelServerActivitiesResponse$Outbound; } diff --git a/src/models/checkforupdatesop.ts b/src/models/checkforupdatesop.ts index 2103f0ae..7472e3b5 100644 --- a/src/models/checkforupdatesop.ts +++ b/src/models/checkforupdatesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -51,7 +51,11 @@ export class CheckForUpdatesResponseBody extends Error { data$: CheckForUpdatesResponseBodyData; constructor(err: CheckForUpdatesResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -61,11 +65,6 @@ export class CheckForUpdatesResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "CheckForUpdatesResponseBody"; } } @@ -86,128 +85,219 @@ export type CheckForUpdatesResponse = { }; /** @internal */ +export const Download$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Download); + +/** @internal */ +export const Download$outboundSchema: z.ZodNativeEnum = Download$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Download$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Download); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Download$inboundSchema` instead. */ + export const inboundSchema = Download$inboundSchema; + /** @deprecated use `Download$outboundSchema` instead. */ + export const outboundSchema = Download$outboundSchema; } /** @internal */ +export const CheckForUpdatesRequest$inboundSchema: z.ZodType< + CheckForUpdatesRequest, + z.ZodTypeDef, + unknown +> = z.object({ + download: Download$inboundSchema.optional(), +}); + +/** @internal */ +export type CheckForUpdatesRequest$Outbound = { + download?: number | undefined; +}; + +/** @internal */ +export const CheckForUpdatesRequest$outboundSchema: z.ZodType< + CheckForUpdatesRequest$Outbound, + z.ZodTypeDef, + CheckForUpdatesRequest +> = z.object({ + download: Download$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CheckForUpdatesRequest$ { - export const inboundSchema: z.ZodType = z.object( - { - download: Download$.inboundSchema.optional(), - } - ); - - export type Outbound = { - download?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - download: Download$.outboundSchema.optional(), - }); + /** @deprecated use `CheckForUpdatesRequest$inboundSchema` instead. */ + export const inboundSchema = CheckForUpdatesRequest$inboundSchema; + /** @deprecated use `CheckForUpdatesRequest$outboundSchema` instead. */ + export const outboundSchema = CheckForUpdatesRequest$outboundSchema; + /** @deprecated use `CheckForUpdatesRequest$Outbound` instead. */ + export type Outbound = CheckForUpdatesRequest$Outbound; } /** @internal */ +export const CheckForUpdatesErrors$inboundSchema: z.ZodType< + CheckForUpdatesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type CheckForUpdatesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const CheckForUpdatesErrors$outboundSchema: z.ZodType< + CheckForUpdatesErrors$Outbound, + z.ZodTypeDef, + CheckForUpdatesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CheckForUpdatesErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `CheckForUpdatesErrors$inboundSchema` instead. */ + export const inboundSchema = CheckForUpdatesErrors$inboundSchema; + /** @deprecated use `CheckForUpdatesErrors$outboundSchema` instead. */ + export const outboundSchema = CheckForUpdatesErrors$outboundSchema; + /** @deprecated use `CheckForUpdatesErrors$Outbound` instead. */ + export type Outbound = CheckForUpdatesErrors$Outbound; +} + +/** @internal */ +export const CheckForUpdatesResponseBody$inboundSchema: z.ZodType< + CheckForUpdatesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => CheckForUpdatesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new CheckForUpdatesResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} +/** @internal */ +export type CheckForUpdatesResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ +export const CheckForUpdatesResponseBody$outboundSchema: z.ZodType< + CheckForUpdatesResponseBody$Outbound, + z.ZodTypeDef, + CheckForUpdatesResponseBody +> = z + .instanceof(CheckForUpdatesResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => CheckForUpdatesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CheckForUpdatesResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => CheckForUpdatesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new CheckForUpdatesResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(CheckForUpdatesResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => CheckForUpdatesErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `CheckForUpdatesResponseBody$inboundSchema` instead. */ + export const inboundSchema = CheckForUpdatesResponseBody$inboundSchema; + /** @deprecated use `CheckForUpdatesResponseBody$outboundSchema` instead. */ + export const outboundSchema = CheckForUpdatesResponseBody$outboundSchema; + /** @deprecated use `CheckForUpdatesResponseBody$Outbound` instead. */ + export type Outbound = CheckForUpdatesResponseBody$Outbound; } /** @internal */ +export const CheckForUpdatesResponse$inboundSchema: z.ZodType< + CheckForUpdatesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type CheckForUpdatesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const CheckForUpdatesResponse$outboundSchema: z.ZodType< + CheckForUpdatesResponse$Outbound, + z.ZodTypeDef, + CheckForUpdatesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CheckForUpdatesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `CheckForUpdatesResponse$inboundSchema` instead. */ + export const inboundSchema = CheckForUpdatesResponse$inboundSchema; + /** @deprecated use `CheckForUpdatesResponse$outboundSchema` instead. */ + export const outboundSchema = CheckForUpdatesResponse$outboundSchema; + /** @deprecated use `CheckForUpdatesResponse$Outbound` instead. */ + export type Outbound = CheckForUpdatesResponse$Outbound; } diff --git a/src/models/clearplaylistcontentsop.ts b/src/models/clearplaylistcontentsop.ts index ff7e6bed..3367ce95 100644 --- a/src/models/clearplaylistcontentsop.ts +++ b/src/models/clearplaylistcontentsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class ClearPlaylistContentsResponseBody extends Error { data$: ClearPlaylistContentsResponseBodyData; constructor(err: ClearPlaylistContentsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class ClearPlaylistContentsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "ClearPlaylistContentsResponseBody"; } } @@ -78,133 +77,204 @@ export type ClearPlaylistContentsResponse = { }; /** @internal */ +export const ClearPlaylistContentsRequest$inboundSchema: z.ZodType< + ClearPlaylistContentsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistID: z.number(), +}); + +/** @internal */ +export type ClearPlaylistContentsRequest$Outbound = { + playlistID: number; +}; + +/** @internal */ +export const ClearPlaylistContentsRequest$outboundSchema: z.ZodType< + ClearPlaylistContentsRequest$Outbound, + z.ZodTypeDef, + ClearPlaylistContentsRequest +> = z.object({ + playlistID: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ClearPlaylistContentsRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - }); - - export type Outbound = { - playlistID: number; - }; - - export const outboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - }); + /** @deprecated use `ClearPlaylistContentsRequest$inboundSchema` instead. */ + export const inboundSchema = ClearPlaylistContentsRequest$inboundSchema; + /** @deprecated use `ClearPlaylistContentsRequest$outboundSchema` instead. */ + export const outboundSchema = ClearPlaylistContentsRequest$outboundSchema; + /** @deprecated use `ClearPlaylistContentsRequest$Outbound` instead. */ + export type Outbound = ClearPlaylistContentsRequest$Outbound; } /** @internal */ +export const ClearPlaylistContentsErrors$inboundSchema: z.ZodType< + ClearPlaylistContentsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type ClearPlaylistContentsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const ClearPlaylistContentsErrors$outboundSchema: z.ZodType< + ClearPlaylistContentsErrors$Outbound, + z.ZodTypeDef, + ClearPlaylistContentsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ClearPlaylistContentsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `ClearPlaylistContentsErrors$inboundSchema` instead. */ + export const inboundSchema = ClearPlaylistContentsErrors$inboundSchema; + /** @deprecated use `ClearPlaylistContentsErrors$outboundSchema` instead. */ + export const outboundSchema = ClearPlaylistContentsErrors$outboundSchema; + /** @deprecated use `ClearPlaylistContentsErrors$Outbound` instead. */ + export type Outbound = ClearPlaylistContentsErrors$Outbound; } /** @internal */ -export namespace ClearPlaylistContentsResponseBody$ { - export const inboundSchema: z.ZodType< - ClearPlaylistContentsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => ClearPlaylistContentsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new ClearPlaylistContentsResponseBody(remapped); +export const ClearPlaylistContentsResponseBody$inboundSchema: z.ZodType< + ClearPlaylistContentsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => ClearPlaylistContentsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - ClearPlaylistContentsResponseBody - > = z - .instanceof(ClearPlaylistContentsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => ClearPlaylistContentsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new ClearPlaylistContentsResponseBody(remapped); + }); /** @internal */ -export namespace ClearPlaylistContentsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export type ClearPlaylistContentsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = +/** @internal */ +export const ClearPlaylistContentsResponseBody$outboundSchema: z.ZodType< + ClearPlaylistContentsResponseBody$Outbound, + z.ZodTypeDef, + ClearPlaylistContentsResponseBody +> = z + .instanceof(ClearPlaylistContentsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), + errors: z + .array(z.lazy(() => ClearPlaylistContentsErrors$outboundSchema)) + .optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ClearPlaylistContentsResponseBody$ { + /** @deprecated use `ClearPlaylistContentsResponseBody$inboundSchema` instead. */ + export const inboundSchema = ClearPlaylistContentsResponseBody$inboundSchema; + /** @deprecated use `ClearPlaylistContentsResponseBody$outboundSchema` instead. */ + export const outboundSchema = ClearPlaylistContentsResponseBody$outboundSchema; + /** @deprecated use `ClearPlaylistContentsResponseBody$Outbound` instead. */ + export type Outbound = ClearPlaylistContentsResponseBody$Outbound; +} + +/** @internal */ +export const ClearPlaylistContentsResponse$inboundSchema: z.ZodType< + ClearPlaylistContentsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type ClearPlaylistContentsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const ClearPlaylistContentsResponse$outboundSchema: z.ZodType< + ClearPlaylistContentsResponse$Outbound, + z.ZodTypeDef, + ClearPlaylistContentsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ClearPlaylistContentsResponse$ { + /** @deprecated use `ClearPlaylistContentsResponse$inboundSchema` instead. */ + export const inboundSchema = ClearPlaylistContentsResponse$inboundSchema; + /** @deprecated use `ClearPlaylistContentsResponse$outboundSchema` instead. */ + export const outboundSchema = ClearPlaylistContentsResponse$outboundSchema; + /** @deprecated use `ClearPlaylistContentsResponse$Outbound` instead. */ + export type Outbound = ClearPlaylistContentsResponse$Outbound; } diff --git a/src/models/createplaylistop.ts b/src/models/createplaylistop.ts index 3fd4a5bf..0243e8b2 100644 --- a/src/models/createplaylistop.ts +++ b/src/models/createplaylistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -76,7 +76,11 @@ export class CreatePlaylistPlaylistsResponseBody extends Error { data$: CreatePlaylistPlaylistsResponseBodyData; constructor(err: CreatePlaylistPlaylistsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -86,11 +90,6 @@ export class CreatePlaylistPlaylistsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "CreatePlaylistPlaylistsResponseBody"; } } @@ -146,277 +145,433 @@ export type CreatePlaylistResponse = { }; /** @internal */ +export const QueryParamType$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(QueryParamType); + +/** @internal */ +export const QueryParamType$outboundSchema: z.ZodNativeEnum = + QueryParamType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace QueryParamType$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(QueryParamType); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `QueryParamType$inboundSchema` instead. */ + export const inboundSchema = QueryParamType$inboundSchema; + /** @deprecated use `QueryParamType$outboundSchema` instead. */ + export const outboundSchema = QueryParamType$outboundSchema; } /** @internal */ +export const Smart$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Smart); + +/** @internal */ +export const Smart$outboundSchema: z.ZodNativeEnum = Smart$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Smart$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Smart); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Smart$inboundSchema` instead. */ + export const inboundSchema = Smart$inboundSchema; + /** @deprecated use `Smart$outboundSchema` instead. */ + export const outboundSchema = Smart$outboundSchema; } /** @internal */ +export const CreatePlaylistRequest$inboundSchema: z.ZodType< + CreatePlaylistRequest, + z.ZodTypeDef, + unknown +> = z.object({ + title: z.string(), + type: QueryParamType$inboundSchema, + smart: Smart$inboundSchema, + uri: z.string(), + playQueueID: z.number().optional(), +}); + +/** @internal */ +export type CreatePlaylistRequest$Outbound = { + title: string; + type: string; + smart: number; + uri: string; + playQueueID?: number | undefined; +}; + +/** @internal */ +export const CreatePlaylistRequest$outboundSchema: z.ZodType< + CreatePlaylistRequest$Outbound, + z.ZodTypeDef, + CreatePlaylistRequest +> = z.object({ + title: z.string(), + type: QueryParamType$outboundSchema, + smart: Smart$outboundSchema, + uri: z.string(), + playQueueID: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistRequest$ { - export const inboundSchema: z.ZodType = z.object({ - title: z.string(), - type: QueryParamType$.inboundSchema, - smart: Smart$.inboundSchema, - uri: z.string(), - playQueueID: z.number().optional(), - }); - - export type Outbound = { - title: string; - type: string; - smart: number; - uri: string; - playQueueID?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - title: z.string(), - type: QueryParamType$.outboundSchema, - smart: Smart$.outboundSchema, - uri: z.string(), - playQueueID: z.number().optional(), - }); + /** @deprecated use `CreatePlaylistRequest$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistRequest$inboundSchema; + /** @deprecated use `CreatePlaylistRequest$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistRequest$outboundSchema; + /** @deprecated use `CreatePlaylistRequest$Outbound` instead. */ + export type Outbound = CreatePlaylistRequest$Outbound; } /** @internal */ +export const CreatePlaylistErrors$inboundSchema: z.ZodType< + CreatePlaylistErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type CreatePlaylistErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const CreatePlaylistErrors$outboundSchema: z.ZodType< + CreatePlaylistErrors$Outbound, + z.ZodTypeDef, + CreatePlaylistErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `CreatePlaylistErrors$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistErrors$inboundSchema; + /** @deprecated use `CreatePlaylistErrors$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistErrors$outboundSchema; + /** @deprecated use `CreatePlaylistErrors$Outbound` instead. */ + export type Outbound = CreatePlaylistErrors$Outbound; +} + +/** @internal */ +export const CreatePlaylistPlaylistsResponseBody$inboundSchema: z.ZodType< + CreatePlaylistPlaylistsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => CreatePlaylistErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new CreatePlaylistPlaylistsResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } - ); -} +/** @internal */ +export type CreatePlaylistPlaylistsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ +export const CreatePlaylistPlaylistsResponseBody$outboundSchema: z.ZodType< + CreatePlaylistPlaylistsResponseBody$Outbound, + z.ZodTypeDef, + CreatePlaylistPlaylistsResponseBody +> = z + .instanceof(CreatePlaylistPlaylistsResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => CreatePlaylistErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistPlaylistsResponseBody$ { - export const inboundSchema: z.ZodType< - CreatePlaylistPlaylistsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => CreatePlaylistErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new CreatePlaylistPlaylistsResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - CreatePlaylistPlaylistsResponseBody - > = z - .instanceof(CreatePlaylistPlaylistsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => CreatePlaylistErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `CreatePlaylistPlaylistsResponseBody$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistPlaylistsResponseBody$inboundSchema; + /** @deprecated use `CreatePlaylistPlaylistsResponseBody$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistPlaylistsResponseBody$outboundSchema; + /** @deprecated use `CreatePlaylistPlaylistsResponseBody$Outbound` instead. */ + export type Outbound = CreatePlaylistPlaylistsResponseBody$Outbound; } /** @internal */ +export const CreatePlaylistMetadata$inboundSchema: z.ZodType< + CreatePlaylistMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + icon: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + composite: z.string().optional(), + duration: z.number().int().optional(), +}); + +/** @internal */ +export type CreatePlaylistMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + type?: string | undefined; + title?: string | undefined; + summary?: string | undefined; + smart?: boolean | undefined; + playlistType?: string | undefined; + icon?: string | undefined; + viewCount?: number | undefined; + lastViewedAt?: number | undefined; + leafCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + composite?: string | undefined; + duration?: number | undefined; +}; + +/** @internal */ +export const CreatePlaylistMetadata$outboundSchema: z.ZodType< + CreatePlaylistMetadata$Outbound, + z.ZodTypeDef, + CreatePlaylistMetadata +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + icon: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + composite: z.string().optional(), + duration: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistMetadata$ { - export const inboundSchema: z.ZodType = z.object( - { - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - icon: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - composite: z.string().optional(), - duration: z.number().int().optional(), - } - ); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - type?: string | undefined; - title?: string | undefined; - summary?: string | undefined; - smart?: boolean | undefined; - playlistType?: string | undefined; - icon?: string | undefined; - viewCount?: number | undefined; - lastViewedAt?: number | undefined; - leafCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - composite?: string | undefined; - duration?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - icon: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - composite: z.string().optional(), - duration: z.number().int().optional(), - }); + /** @deprecated use `CreatePlaylistMetadata$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistMetadata$inboundSchema; + /** @deprecated use `CreatePlaylistMetadata$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistMetadata$outboundSchema; + /** @deprecated use `CreatePlaylistMetadata$Outbound` instead. */ + export type Outbound = CreatePlaylistMetadata$Outbound; } /** @internal */ +export const CreatePlaylistMediaContainer$inboundSchema: z.ZodType< + CreatePlaylistMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Metadata: z.array(z.lazy(() => CreatePlaylistMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type CreatePlaylistMediaContainer$Outbound = { + size?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const CreatePlaylistMediaContainer$outboundSchema: z.ZodType< + CreatePlaylistMediaContainer$Outbound, + z.ZodTypeDef, + CreatePlaylistMediaContainer +> = z + .object({ + size: z.number().int().optional(), + metadata: z.array(z.lazy(() => CreatePlaylistMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - Metadata: z.array(z.lazy(() => CreatePlaylistMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - metadata: z.array(z.lazy(() => CreatePlaylistMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `CreatePlaylistMediaContainer$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistMediaContainer$inboundSchema; + /** @deprecated use `CreatePlaylistMediaContainer$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistMediaContainer$outboundSchema; + /** @deprecated use `CreatePlaylistMediaContainer$Outbound` instead. */ + export type Outbound = CreatePlaylistMediaContainer$Outbound; } /** @internal */ +export const CreatePlaylistResponseBody$inboundSchema: z.ZodType< + CreatePlaylistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => CreatePlaylistMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type CreatePlaylistResponseBody$Outbound = { + MediaContainer?: CreatePlaylistMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const CreatePlaylistResponseBody$outboundSchema: z.ZodType< + CreatePlaylistResponseBody$Outbound, + z.ZodTypeDef, + CreatePlaylistResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => CreatePlaylistMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => CreatePlaylistMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: CreatePlaylistMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => CreatePlaylistMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `CreatePlaylistResponseBody$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistResponseBody$inboundSchema; + /** @deprecated use `CreatePlaylistResponseBody$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistResponseBody$outboundSchema; + /** @deprecated use `CreatePlaylistResponseBody$Outbound` instead. */ + export type Outbound = CreatePlaylistResponseBody$Outbound; } /** @internal */ +export const CreatePlaylistResponse$inboundSchema: z.ZodType< + CreatePlaylistResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => CreatePlaylistResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type CreatePlaylistResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: CreatePlaylistResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const CreatePlaylistResponse$outboundSchema: z.ZodType< + CreatePlaylistResponse$Outbound, + z.ZodTypeDef, + CreatePlaylistResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => CreatePlaylistResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace CreatePlaylistResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => CreatePlaylistResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: CreatePlaylistResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => CreatePlaylistResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `CreatePlaylistResponse$inboundSchema` instead. */ + export const inboundSchema = CreatePlaylistResponse$inboundSchema; + /** @deprecated use `CreatePlaylistResponse$outboundSchema` instead. */ + export const outboundSchema = CreatePlaylistResponse$outboundSchema; + /** @deprecated use `CreatePlaylistResponse$Outbound` instead. */ + export type Outbound = CreatePlaylistResponse$Outbound; } diff --git a/src/models/deletelibraryop.ts b/src/models/deletelibraryop.ts index 27edfc8b..a42e6bd1 100644 --- a/src/models/deletelibraryop.ts +++ b/src/models/deletelibraryop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class DeleteLibraryResponseBody extends Error { data$: DeleteLibraryResponseBodyData; constructor(err: DeleteLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class DeleteLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "DeleteLibraryResponseBody"; } } @@ -78,120 +77,202 @@ export type DeleteLibraryResponse = { }; /** @internal */ +export const DeleteLibraryRequest$inboundSchema: z.ZodType< + DeleteLibraryRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sectionId: z.number(), +}); + +/** @internal */ +export type DeleteLibraryRequest$Outbound = { + sectionId: number; +}; + +/** @internal */ +export const DeleteLibraryRequest$outboundSchema: z.ZodType< + DeleteLibraryRequest$Outbound, + z.ZodTypeDef, + DeleteLibraryRequest +> = z.object({ + sectionId: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeleteLibraryRequest$ { - export const inboundSchema: z.ZodType = z.object({ - sectionId: z.number(), - }); - - export type Outbound = { - sectionId: number; - }; - - export const outboundSchema: z.ZodType = z.object( - { - sectionId: z.number(), - } - ); + /** @deprecated use `DeleteLibraryRequest$inboundSchema` instead. */ + export const inboundSchema = DeleteLibraryRequest$inboundSchema; + /** @deprecated use `DeleteLibraryRequest$outboundSchema` instead. */ + export const outboundSchema = DeleteLibraryRequest$outboundSchema; + /** @deprecated use `DeleteLibraryRequest$Outbound` instead. */ + export type Outbound = DeleteLibraryRequest$Outbound; } /** @internal */ +export const DeleteLibraryErrors$inboundSchema: z.ZodType< + DeleteLibraryErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type DeleteLibraryErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const DeleteLibraryErrors$outboundSchema: z.ZodType< + DeleteLibraryErrors$Outbound, + z.ZodTypeDef, + DeleteLibraryErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeleteLibraryErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `DeleteLibraryErrors$inboundSchema` instead. */ + export const inboundSchema = DeleteLibraryErrors$inboundSchema; + /** @deprecated use `DeleteLibraryErrors$outboundSchema` instead. */ + export const outboundSchema = DeleteLibraryErrors$outboundSchema; + /** @deprecated use `DeleteLibraryErrors$Outbound` instead. */ + export type Outbound = DeleteLibraryErrors$Outbound; } /** @internal */ +export const DeleteLibraryResponseBody$inboundSchema: z.ZodType< + DeleteLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => DeleteLibraryErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new DeleteLibraryResponseBody(remapped); + }); + +/** @internal */ +export type DeleteLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const DeleteLibraryResponseBody$outboundSchema: z.ZodType< + DeleteLibraryResponseBody$Outbound, + z.ZodTypeDef, + DeleteLibraryResponseBody +> = z + .instanceof(DeleteLibraryResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => DeleteLibraryErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeleteLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => DeleteLibraryErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new DeleteLibraryResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(DeleteLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => DeleteLibraryErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `DeleteLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = DeleteLibraryResponseBody$inboundSchema; + /** @deprecated use `DeleteLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = DeleteLibraryResponseBody$outboundSchema; + /** @deprecated use `DeleteLibraryResponseBody$Outbound` instead. */ + export type Outbound = DeleteLibraryResponseBody$Outbound; } /** @internal */ +export const DeleteLibraryResponse$inboundSchema: z.ZodType< + DeleteLibraryResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type DeleteLibraryResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const DeleteLibraryResponse$outboundSchema: z.ZodType< + DeleteLibraryResponse$Outbound, + z.ZodTypeDef, + DeleteLibraryResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeleteLibraryResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `DeleteLibraryResponse$inboundSchema` instead. */ + export const inboundSchema = DeleteLibraryResponse$inboundSchema; + /** @deprecated use `DeleteLibraryResponse$outboundSchema` instead. */ + export const outboundSchema = DeleteLibraryResponse$outboundSchema; + /** @deprecated use `DeleteLibraryResponse$Outbound` instead. */ + export type Outbound = DeleteLibraryResponse$Outbound; } diff --git a/src/models/deleteplaylistop.ts b/src/models/deleteplaylistop.ts index 09f9ad0d..3233610f 100644 --- a/src/models/deleteplaylistop.ts +++ b/src/models/deleteplaylistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class DeletePlaylistResponseBody extends Error { data$: DeletePlaylistResponseBodyData; constructor(err: DeletePlaylistResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class DeletePlaylistResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "DeletePlaylistResponseBody"; } } @@ -78,121 +77,202 @@ export type DeletePlaylistResponse = { }; /** @internal */ +export const DeletePlaylistRequest$inboundSchema: z.ZodType< + DeletePlaylistRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistID: z.number(), +}); + +/** @internal */ +export type DeletePlaylistRequest$Outbound = { + playlistID: number; +}; + +/** @internal */ +export const DeletePlaylistRequest$outboundSchema: z.ZodType< + DeletePlaylistRequest$Outbound, + z.ZodTypeDef, + DeletePlaylistRequest +> = z.object({ + playlistID: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeletePlaylistRequest$ { - export const inboundSchema: z.ZodType = z.object({ - playlistID: z.number(), - }); - - export type Outbound = { - playlistID: number; - }; - - export const outboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - }); + /** @deprecated use `DeletePlaylistRequest$inboundSchema` instead. */ + export const inboundSchema = DeletePlaylistRequest$inboundSchema; + /** @deprecated use `DeletePlaylistRequest$outboundSchema` instead. */ + export const outboundSchema = DeletePlaylistRequest$outboundSchema; + /** @deprecated use `DeletePlaylistRequest$Outbound` instead. */ + export type Outbound = DeletePlaylistRequest$Outbound; } /** @internal */ +export const DeletePlaylistErrors$inboundSchema: z.ZodType< + DeletePlaylistErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type DeletePlaylistErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const DeletePlaylistErrors$outboundSchema: z.ZodType< + DeletePlaylistErrors$Outbound, + z.ZodTypeDef, + DeletePlaylistErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeletePlaylistErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `DeletePlaylistErrors$inboundSchema` instead. */ + export const inboundSchema = DeletePlaylistErrors$inboundSchema; + /** @deprecated use `DeletePlaylistErrors$outboundSchema` instead. */ + export const outboundSchema = DeletePlaylistErrors$outboundSchema; + /** @deprecated use `DeletePlaylistErrors$Outbound` instead. */ + export type Outbound = DeletePlaylistErrors$Outbound; +} + +/** @internal */ +export const DeletePlaylistResponseBody$inboundSchema: z.ZodType< + DeletePlaylistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => DeletePlaylistErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new DeletePlaylistResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; +/** @internal */ +export type DeletePlaylistResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } +/** @internal */ +export const DeletePlaylistResponseBody$outboundSchema: z.ZodType< + DeletePlaylistResponseBody$Outbound, + z.ZodTypeDef, + DeletePlaylistResponseBody +> = z + .instanceof(DeletePlaylistResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => DeletePlaylistErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); -} -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeletePlaylistResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => DeletePlaylistErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new DeletePlaylistResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(DeletePlaylistResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => DeletePlaylistErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `DeletePlaylistResponseBody$inboundSchema` instead. */ + export const inboundSchema = DeletePlaylistResponseBody$inboundSchema; + /** @deprecated use `DeletePlaylistResponseBody$outboundSchema` instead. */ + export const outboundSchema = DeletePlaylistResponseBody$outboundSchema; + /** @deprecated use `DeletePlaylistResponseBody$Outbound` instead. */ + export type Outbound = DeletePlaylistResponseBody$Outbound; } /** @internal */ +export const DeletePlaylistResponse$inboundSchema: z.ZodType< + DeletePlaylistResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type DeletePlaylistResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const DeletePlaylistResponse$outboundSchema: z.ZodType< + DeletePlaylistResponse$Outbound, + z.ZodTypeDef, + DeletePlaylistResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace DeletePlaylistResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `DeletePlaylistResponse$inboundSchema` instead. */ + export const inboundSchema = DeletePlaylistResponse$inboundSchema; + /** @deprecated use `DeletePlaylistResponse$outboundSchema` instead. */ + export const outboundSchema = DeletePlaylistResponse$outboundSchema; + /** @deprecated use `DeletePlaylistResponse$Outbound` instead. */ + export type Outbound = DeletePlaylistResponse$Outbound; } diff --git a/src/models/enablepapertrailop.ts b/src/models/enablepapertrailop.ts index d6a2041d..fe30114d 100644 --- a/src/models/enablepapertrailop.ts +++ b/src/models/enablepapertrailop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class EnablePaperTrailResponseBody extends Error { data$: EnablePaperTrailResponseBodyData; constructor(err: EnablePaperTrailResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class EnablePaperTrailResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "EnablePaperTrailResponseBody"; } } @@ -71,108 +70,166 @@ export type EnablePaperTrailResponse = { }; /** @internal */ +export const EnablePaperTrailErrors$inboundSchema: z.ZodType< + EnablePaperTrailErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type EnablePaperTrailErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const EnablePaperTrailErrors$outboundSchema: z.ZodType< + EnablePaperTrailErrors$Outbound, + z.ZodTypeDef, + EnablePaperTrailErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace EnablePaperTrailErrors$ { - export const inboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } + /** @deprecated use `EnablePaperTrailErrors$inboundSchema` instead. */ + export const inboundSchema = EnablePaperTrailErrors$inboundSchema; + /** @deprecated use `EnablePaperTrailErrors$outboundSchema` instead. */ + export const outboundSchema = EnablePaperTrailErrors$outboundSchema; + /** @deprecated use `EnablePaperTrailErrors$Outbound` instead. */ + export type Outbound = EnablePaperTrailErrors$Outbound; +} + +/** @internal */ +export const EnablePaperTrailResponseBody$inboundSchema: z.ZodType< + EnablePaperTrailResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => EnablePaperTrailErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new EnablePaperTrailResponseBody(remapped); + }); + +/** @internal */ +export type EnablePaperTrailResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const EnablePaperTrailResponseBody$outboundSchema: z.ZodType< + EnablePaperTrailResponseBody$Outbound, + z.ZodTypeDef, + EnablePaperTrailResponseBody +> = z + .instanceof(EnablePaperTrailResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => EnablePaperTrailErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} - -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace EnablePaperTrailResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => EnablePaperTrailErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new EnablePaperTrailResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(EnablePaperTrailResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => EnablePaperTrailErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `EnablePaperTrailResponseBody$inboundSchema` instead. */ + export const inboundSchema = EnablePaperTrailResponseBody$inboundSchema; + /** @deprecated use `EnablePaperTrailResponseBody$outboundSchema` instead. */ + export const outboundSchema = EnablePaperTrailResponseBody$outboundSchema; + /** @deprecated use `EnablePaperTrailResponseBody$Outbound` instead. */ + export type Outbound = EnablePaperTrailResponseBody$Outbound; } /** @internal */ +export const EnablePaperTrailResponse$inboundSchema: z.ZodType< + EnablePaperTrailResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type EnablePaperTrailResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const EnablePaperTrailResponse$outboundSchema: z.ZodType< + EnablePaperTrailResponse$Outbound, + z.ZodTypeDef, + EnablePaperTrailResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace EnablePaperTrailResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `EnablePaperTrailResponse$inboundSchema` instead. */ + export const inboundSchema = EnablePaperTrailResponse$inboundSchema; + /** @deprecated use `EnablePaperTrailResponse$outboundSchema` instead. */ + export const outboundSchema = EnablePaperTrailResponse$outboundSchema; + /** @deprecated use `EnablePaperTrailResponse$Outbound` instead. */ + export type Outbound = EnablePaperTrailResponse$Outbound; } diff --git a/src/models/getavailableclientsop.ts b/src/models/getavailableclientsop.ts index 1cc87187..b77c77fc 100644 --- a/src/models/getavailableclientsop.ts +++ b/src/models/getavailableclientsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetAvailableClientsServerResponseBody extends Error { data$: GetAvailableClientsServerResponseBodyData; constructor(err: GetAvailableClientsServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetAvailableClientsServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetAvailableClientsServerResponseBody"; } } @@ -101,239 +100,334 @@ export type GetAvailableClientsResponse = { }; /** @internal */ +export const GetAvailableClientsErrors$inboundSchema: z.ZodType< + GetAvailableClientsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetAvailableClientsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetAvailableClientsErrors$outboundSchema: z.ZodType< + GetAvailableClientsErrors$Outbound, + z.ZodTypeDef, + GetAvailableClientsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetAvailableClientsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetAvailableClientsErrors$inboundSchema` instead. */ + export const inboundSchema = GetAvailableClientsErrors$inboundSchema; + /** @deprecated use `GetAvailableClientsErrors$outboundSchema` instead. */ + export const outboundSchema = GetAvailableClientsErrors$outboundSchema; + /** @deprecated use `GetAvailableClientsErrors$Outbound` instead. */ + export type Outbound = GetAvailableClientsErrors$Outbound; } /** @internal */ -export namespace GetAvailableClientsServerResponseBody$ { - export const inboundSchema: z.ZodType< - GetAvailableClientsServerResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetAvailableClientsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetAvailableClientsServerResponseBody(remapped); +export const GetAvailableClientsServerResponseBody$inboundSchema: z.ZodType< + GetAvailableClientsServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetAvailableClientsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetAvailableClientsServerResponseBody - > = z - .instanceof(GetAvailableClientsServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetAvailableClientsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new GetAvailableClientsServerResponseBody(remapped); + }); /** @internal */ -export namespace GetAvailableClientsServer$ { - export const inboundSchema: z.ZodType = - z.object({ - name: z.string().optional(), - host: z.string().optional(), - address: z.string().optional(), - port: z.number().optional(), - machineIdentifier: z.string().optional(), - version: z.string().optional(), - protocol: z.string().optional(), - product: z.string().optional(), - deviceClass: z.string().optional(), - protocolVersion: z.number().optional(), - protocolCapabilities: z.string().optional(), - }); - - export type Outbound = { - name?: string | undefined; - host?: string | undefined; - address?: string | undefined; - port?: number | undefined; - machineIdentifier?: string | undefined; - version?: string | undefined; - protocol?: string | undefined; - product?: string | undefined; - deviceClass?: string | undefined; - protocolVersion?: number | undefined; - protocolCapabilities?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - name: z.string().optional(), - host: z.string().optional(), - address: z.string().optional(), - port: z.number().optional(), - machineIdentifier: z.string().optional(), - version: z.string().optional(), - protocol: z.string().optional(), - product: z.string().optional(), - deviceClass: z.string().optional(), - protocolVersion: z.number().optional(), - protocolCapabilities: z.string().optional(), - }); -} +export type GetAvailableClientsServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetAvailableClientsMediaContainer$ { - export const inboundSchema: z.ZodType< - GetAvailableClientsMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().optional(), - Server: z.array(z.lazy(() => GetAvailableClientsServer$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Server: "server", - }); - }); - - export type Outbound = { - size?: number | undefined; - Server?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetAvailableClientsMediaContainer - > = z - .object({ - size: z.number().optional(), - server: z.array(z.lazy(() => GetAvailableClientsServer$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - server: "Server", - }); - }); -} - -/** @internal */ -export namespace GetAvailableClientsResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetAvailableClientsServerResponseBody$outboundSchema: z.ZodType< + GetAvailableClientsServerResponseBody$Outbound, + z.ZodTypeDef, + GetAvailableClientsServerResponseBody +> = z + .instanceof(GetAvailableClientsServerResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => GetAvailableClientsMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => GetAvailableClientsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: GetAvailableClientsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetAvailableClientsResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetAvailableClientsMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetAvailableClientsServerResponseBody$ { + /** @deprecated use `GetAvailableClientsServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetAvailableClientsServerResponseBody$inboundSchema; + /** @deprecated use `GetAvailableClientsServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetAvailableClientsServerResponseBody$outboundSchema; + /** @deprecated use `GetAvailableClientsServerResponseBody$Outbound` instead. */ + export type Outbound = GetAvailableClientsServerResponseBody$Outbound; } /** @internal */ -export namespace GetAvailableClientsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetAvailableClientsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const GetAvailableClientsServer$inboundSchema: z.ZodType< + GetAvailableClientsServer, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string().optional(), + host: z.string().optional(), + address: z.string().optional(), + port: z.number().optional(), + machineIdentifier: z.string().optional(), + version: z.string().optional(), + protocol: z.string().optional(), + product: z.string().optional(), + deviceClass: z.string().optional(), + protocolVersion: z.number().optional(), + protocolCapabilities: z.string().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetAvailableClientsResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type GetAvailableClientsServer$Outbound = { + name?: string | undefined; + host?: string | undefined; + address?: string | undefined; + port?: number | undefined; + machineIdentifier?: string | undefined; + version?: string | undefined; + protocol?: string | undefined; + product?: string | undefined; + deviceClass?: string | undefined; + protocolVersion?: number | undefined; + protocolCapabilities?: string | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetAvailableClientsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const GetAvailableClientsServer$outboundSchema: z.ZodType< + GetAvailableClientsServer$Outbound, + z.ZodTypeDef, + GetAvailableClientsServer +> = z.object({ + name: z.string().optional(), + host: z.string().optional(), + address: z.string().optional(), + port: z.number().optional(), + machineIdentifier: z.string().optional(), + version: z.string().optional(), + protocol: z.string().optional(), + product: z.string().optional(), + deviceClass: z.string().optional(), + protocolVersion: z.number().optional(), + protocolCapabilities: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetAvailableClientsServer$ { + /** @deprecated use `GetAvailableClientsServer$inboundSchema` instead. */ + export const inboundSchema = GetAvailableClientsServer$inboundSchema; + /** @deprecated use `GetAvailableClientsServer$outboundSchema` instead. */ + export const outboundSchema = GetAvailableClientsServer$outboundSchema; + /** @deprecated use `GetAvailableClientsServer$Outbound` instead. */ + export type Outbound = GetAvailableClientsServer$Outbound; +} + +/** @internal */ +export const GetAvailableClientsMediaContainer$inboundSchema: z.ZodType< + GetAvailableClientsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + Server: z.array(z.lazy(() => GetAvailableClientsServer$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Server: "server", + }); + }); + +/** @internal */ +export type GetAvailableClientsMediaContainer$Outbound = { + size?: number | undefined; + Server?: Array | undefined; +}; + +/** @internal */ +export const GetAvailableClientsMediaContainer$outboundSchema: z.ZodType< + GetAvailableClientsMediaContainer$Outbound, + z.ZodTypeDef, + GetAvailableClientsMediaContainer +> = z + .object({ + size: z.number().optional(), + server: z.array(z.lazy(() => GetAvailableClientsServer$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + server: "Server", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetAvailableClientsMediaContainer$ { + /** @deprecated use `GetAvailableClientsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetAvailableClientsMediaContainer$inboundSchema; + /** @deprecated use `GetAvailableClientsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetAvailableClientsMediaContainer$outboundSchema; + /** @deprecated use `GetAvailableClientsMediaContainer$Outbound` instead. */ + export type Outbound = GetAvailableClientsMediaContainer$Outbound; +} + +/** @internal */ +export const GetAvailableClientsResponseBody$inboundSchema: z.ZodType< + GetAvailableClientsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetAvailableClientsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetAvailableClientsResponseBody$Outbound = { + MediaContainer?: GetAvailableClientsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetAvailableClientsResponseBody$outboundSchema: z.ZodType< + GetAvailableClientsResponseBody$Outbound, + z.ZodTypeDef, + GetAvailableClientsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetAvailableClientsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetAvailableClientsResponseBody$ { + /** @deprecated use `GetAvailableClientsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetAvailableClientsResponseBody$inboundSchema; + /** @deprecated use `GetAvailableClientsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetAvailableClientsResponseBody$outboundSchema; + /** @deprecated use `GetAvailableClientsResponseBody$Outbound` instead. */ + export type Outbound = GetAvailableClientsResponseBody$Outbound; +} + +/** @internal */ +export const GetAvailableClientsResponse$inboundSchema: z.ZodType< + GetAvailableClientsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetAvailableClientsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetAvailableClientsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetAvailableClientsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetAvailableClientsResponse$outboundSchema: z.ZodType< + GetAvailableClientsResponse$Outbound, + z.ZodTypeDef, + GetAvailableClientsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetAvailableClientsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetAvailableClientsResponse$ { + /** @deprecated use `GetAvailableClientsResponse$inboundSchema` instead. */ + export const inboundSchema = GetAvailableClientsResponse$inboundSchema; + /** @deprecated use `GetAvailableClientsResponse$outboundSchema` instead. */ + export const outboundSchema = GetAvailableClientsResponse$outboundSchema; + /** @deprecated use `GetAvailableClientsResponse$Outbound` instead. */ + export type Outbound = GetAvailableClientsResponse$Outbound; } diff --git a/src/models/getbandwidthstatisticsop.ts b/src/models/getbandwidthstatisticsop.ts index f008473e..c5c08682 100644 --- a/src/models/getbandwidthstatisticsop.ts +++ b/src/models/getbandwidthstatisticsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -47,7 +47,11 @@ export class GetBandwidthStatisticsStatisticsResponseBody extends Error { data$: GetBandwidthStatisticsStatisticsResponseBodyData; constructor(err: GetBandwidthStatisticsStatisticsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -57,11 +61,6 @@ export class GetBandwidthStatisticsStatisticsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetBandwidthStatisticsStatisticsResponseBody"; } } @@ -128,337 +127,486 @@ export type GetBandwidthStatisticsResponse = { }; /** @internal */ +export const GetBandwidthStatisticsRequest$inboundSchema: z.ZodType< + GetBandwidthStatisticsRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + Timespan: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + Timespan: "timespan", + }); + }); + +/** @internal */ +export type GetBandwidthStatisticsRequest$Outbound = { + Timespan?: number | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsRequest$outboundSchema: z.ZodType< + GetBandwidthStatisticsRequest$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsRequest +> = z + .object({ + timespan: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + timespan: "Timespan", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetBandwidthStatisticsRequest$ { - export const inboundSchema: z.ZodType = z - .object({ - Timespan: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - Timespan: "timespan", - }); - }); - - export type Outbound = { - Timespan?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z - .object({ - timespan: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - timespan: "Timespan", - }); - }); + /** @deprecated use `GetBandwidthStatisticsRequest$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsRequest$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsRequest$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsRequest$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsRequest$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsRequest$Outbound; } /** @internal */ +export const GetBandwidthStatisticsErrors$inboundSchema: z.ZodType< + GetBandwidthStatisticsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetBandwidthStatisticsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsErrors$outboundSchema: z.ZodType< + GetBandwidthStatisticsErrors$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetBandwidthStatisticsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetBandwidthStatisticsErrors$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsErrors$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsErrors$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsErrors$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsErrors$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsErrors$Outbound; } /** @internal */ -export namespace GetBandwidthStatisticsStatisticsResponseBody$ { - export const inboundSchema: z.ZodType< - GetBandwidthStatisticsStatisticsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetBandwidthStatisticsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetBandwidthStatisticsStatisticsResponseBody(remapped); +export const GetBandwidthStatisticsStatisticsResponseBody$inboundSchema: z.ZodType< + GetBandwidthStatisticsStatisticsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetBandwidthStatisticsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetBandwidthStatisticsStatisticsResponseBody - > = z - .instanceof(GetBandwidthStatisticsStatisticsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetBandwidthStatisticsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace GetBandwidthStatisticsDevice$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - name: z.string().optional(), - platform: z.string().optional(), - clientIdentifier: z.string().optional(), - createdAt: z.number().int().optional(), - }); - - export type Outbound = { - id?: number | undefined; - name?: string | undefined; - platform?: string | undefined; - clientIdentifier?: string | undefined; - createdAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - name: z.string().optional(), - platform: z.string().optional(), - clientIdentifier: z.string().optional(), - createdAt: z.number().int().optional(), - }); -} - -/** @internal */ -export namespace GetBandwidthStatisticsAccount$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - name: z.string().optional(), - defaultAudioLanguage: z.string().optional(), - autoSelectAudio: z.boolean().optional(), - defaultSubtitleLanguage: z.string().optional(), - subtitleMode: z.number().int().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - name?: string | undefined; - defaultAudioLanguage?: string | undefined; - autoSelectAudio?: boolean | undefined; - defaultSubtitleLanguage?: string | undefined; - subtitleMode?: number | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - name: z.string().optional(), - defaultAudioLanguage: z.string().optional(), - autoSelectAudio: z.boolean().optional(), - defaultSubtitleLanguage: z.string().optional(), - subtitleMode: z.number().int().optional(), - thumb: z.string().optional(), - }); -} - -/** @internal */ -export namespace StatisticsBandwidth$ { - export const inboundSchema: z.ZodType = z.object({ - accountID: z.number().int().optional(), - deviceID: z.number().int().optional(), - timespan: z.number().int().optional(), - at: z.number().int().optional(), - lan: z.boolean().optional(), - bytes: z.number().int().optional(), + return new GetBandwidthStatisticsStatisticsResponseBody(remapped); }); - export type Outbound = { - accountID?: number | undefined; - deviceID?: number | undefined; - timespan?: number | undefined; - at?: number | undefined; - lan?: boolean | undefined; - bytes?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - accountID: z.number().int().optional(), - deviceID: z.number().int().optional(), - timespan: z.number().int().optional(), - at: z.number().int().optional(), - lan: z.boolean().optional(), - bytes: z.number().int().optional(), - }); -} +/** @internal */ +export type GetBandwidthStatisticsStatisticsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetBandwidthStatisticsMediaContainer$ { - export const inboundSchema: z.ZodType< - GetBandwidthStatisticsMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - Device: z.array(z.lazy(() => GetBandwidthStatisticsDevice$.inboundSchema)).optional(), - Account: z.array(z.lazy(() => GetBandwidthStatisticsAccount$.inboundSchema)).optional(), - StatisticsBandwidth: z - .array(z.lazy(() => StatisticsBandwidth$.inboundSchema)) - .optional(), - }) - .transform((v) => { - return remap$(v, { - Device: "device", - Account: "account", - StatisticsBandwidth: "statisticsBandwidth", - }); - }); - - export type Outbound = { - size?: number | undefined; - Device?: Array | undefined; - Account?: Array | undefined; - StatisticsBandwidth?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetBandwidthStatisticsMediaContainer - > = z - .object({ - size: z.number().int().optional(), - device: z.array(z.lazy(() => GetBandwidthStatisticsDevice$.outboundSchema)).optional(), - account: z - .array(z.lazy(() => GetBandwidthStatisticsAccount$.outboundSchema)) - .optional(), - statisticsBandwidth: z - .array(z.lazy(() => StatisticsBandwidth$.outboundSchema)) - .optional(), - }) - .transform((v) => { - return remap$(v, { - device: "Device", - account: "Account", - statisticsBandwidth: "StatisticsBandwidth", - }); - }); -} - -/** @internal */ -export namespace GetBandwidthStatisticsResponseBody$ { - export const inboundSchema: z.ZodType< - GetBandwidthStatisticsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - MediaContainer: z - .lazy(() => GetBandwidthStatisticsMediaContainer$.inboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetBandwidthStatisticsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetBandwidthStatisticsResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetBandwidthStatisticsMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); -} - -/** @internal */ -export namespace GetBandwidthStatisticsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetBandwidthStatisticsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetBandwidthStatisticsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetBandwidthStatisticsStatisticsResponseBody$outboundSchema: z.ZodType< + GetBandwidthStatisticsStatisticsResponseBody$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsStatisticsResponseBody +> = z + .instanceof(GetBandwidthStatisticsStatisticsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetBandwidthStatisticsResponseBody$.outboundSchema).optional(), + errors: z + .array(z.lazy(() => GetBandwidthStatisticsErrors$outboundSchema)) + .optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetBandwidthStatisticsStatisticsResponseBody$ { + /** @deprecated use `GetBandwidthStatisticsStatisticsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsStatisticsResponseBody$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsStatisticsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsStatisticsResponseBody$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsStatisticsResponseBody$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsStatisticsResponseBody$Outbound; +} + +/** @internal */ +export const GetBandwidthStatisticsDevice$inboundSchema: z.ZodType< + GetBandwidthStatisticsDevice, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + name: z.string().optional(), + platform: z.string().optional(), + clientIdentifier: z.string().optional(), + createdAt: z.number().int().optional(), +}); + +/** @internal */ +export type GetBandwidthStatisticsDevice$Outbound = { + id?: number | undefined; + name?: string | undefined; + platform?: string | undefined; + clientIdentifier?: string | undefined; + createdAt?: number | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsDevice$outboundSchema: z.ZodType< + GetBandwidthStatisticsDevice$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsDevice +> = z.object({ + id: z.number().int().optional(), + name: z.string().optional(), + platform: z.string().optional(), + clientIdentifier: z.string().optional(), + createdAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetBandwidthStatisticsDevice$ { + /** @deprecated use `GetBandwidthStatisticsDevice$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsDevice$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsDevice$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsDevice$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsDevice$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsDevice$Outbound; +} + +/** @internal */ +export const GetBandwidthStatisticsAccount$inboundSchema: z.ZodType< + GetBandwidthStatisticsAccount, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + name: z.string().optional(), + defaultAudioLanguage: z.string().optional(), + autoSelectAudio: z.boolean().optional(), + defaultSubtitleLanguage: z.string().optional(), + subtitleMode: z.number().int().optional(), + thumb: z.string().optional(), +}); + +/** @internal */ +export type GetBandwidthStatisticsAccount$Outbound = { + id?: number | undefined; + key?: string | undefined; + name?: string | undefined; + defaultAudioLanguage?: string | undefined; + autoSelectAudio?: boolean | undefined; + defaultSubtitleLanguage?: string | undefined; + subtitleMode?: number | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsAccount$outboundSchema: z.ZodType< + GetBandwidthStatisticsAccount$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsAccount +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + name: z.string().optional(), + defaultAudioLanguage: z.string().optional(), + autoSelectAudio: z.boolean().optional(), + defaultSubtitleLanguage: z.string().optional(), + subtitleMode: z.number().int().optional(), + thumb: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetBandwidthStatisticsAccount$ { + /** @deprecated use `GetBandwidthStatisticsAccount$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsAccount$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsAccount$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsAccount$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsAccount$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsAccount$Outbound; +} + +/** @internal */ +export const StatisticsBandwidth$inboundSchema: z.ZodType< + StatisticsBandwidth, + z.ZodTypeDef, + unknown +> = z.object({ + accountID: z.number().int().optional(), + deviceID: z.number().int().optional(), + timespan: z.number().int().optional(), + at: z.number().int().optional(), + lan: z.boolean().optional(), + bytes: z.number().int().optional(), +}); + +/** @internal */ +export type StatisticsBandwidth$Outbound = { + accountID?: number | undefined; + deviceID?: number | undefined; + timespan?: number | undefined; + at?: number | undefined; + lan?: boolean | undefined; + bytes?: number | undefined; +}; + +/** @internal */ +export const StatisticsBandwidth$outboundSchema: z.ZodType< + StatisticsBandwidth$Outbound, + z.ZodTypeDef, + StatisticsBandwidth +> = z.object({ + accountID: z.number().int().optional(), + deviceID: z.number().int().optional(), + timespan: z.number().int().optional(), + at: z.number().int().optional(), + lan: z.boolean().optional(), + bytes: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StatisticsBandwidth$ { + /** @deprecated use `StatisticsBandwidth$inboundSchema` instead. */ + export const inboundSchema = StatisticsBandwidth$inboundSchema; + /** @deprecated use `StatisticsBandwidth$outboundSchema` instead. */ + export const outboundSchema = StatisticsBandwidth$outboundSchema; + /** @deprecated use `StatisticsBandwidth$Outbound` instead. */ + export type Outbound = StatisticsBandwidth$Outbound; +} + +/** @internal */ +export const GetBandwidthStatisticsMediaContainer$inboundSchema: z.ZodType< + GetBandwidthStatisticsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Device: z.array(z.lazy(() => GetBandwidthStatisticsDevice$inboundSchema)).optional(), + Account: z.array(z.lazy(() => GetBandwidthStatisticsAccount$inboundSchema)).optional(), + StatisticsBandwidth: z.array(z.lazy(() => StatisticsBandwidth$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Device: "device", + Account: "account", + StatisticsBandwidth: "statisticsBandwidth", + }); + }); + +/** @internal */ +export type GetBandwidthStatisticsMediaContainer$Outbound = { + size?: number | undefined; + Device?: Array | undefined; + Account?: Array | undefined; + StatisticsBandwidth?: Array | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsMediaContainer$outboundSchema: z.ZodType< + GetBandwidthStatisticsMediaContainer$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + device: z.array(z.lazy(() => GetBandwidthStatisticsDevice$outboundSchema)).optional(), + account: z.array(z.lazy(() => GetBandwidthStatisticsAccount$outboundSchema)).optional(), + statisticsBandwidth: z.array(z.lazy(() => StatisticsBandwidth$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + device: "Device", + account: "Account", + statisticsBandwidth: "StatisticsBandwidth", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetBandwidthStatisticsMediaContainer$ { + /** @deprecated use `GetBandwidthStatisticsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsMediaContainer$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsMediaContainer$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsMediaContainer$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsMediaContainer$Outbound; +} + +/** @internal */ +export const GetBandwidthStatisticsResponseBody$inboundSchema: z.ZodType< + GetBandwidthStatisticsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetBandwidthStatisticsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetBandwidthStatisticsResponseBody$Outbound = { + MediaContainer?: GetBandwidthStatisticsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsResponseBody$outboundSchema: z.ZodType< + GetBandwidthStatisticsResponseBody$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsResponseBody +> = z + .object({ + mediaContainer: z + .lazy(() => GetBandwidthStatisticsMediaContainer$outboundSchema) + .optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetBandwidthStatisticsResponseBody$ { + /** @deprecated use `GetBandwidthStatisticsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsResponseBody$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsResponseBody$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsResponseBody$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsResponseBody$Outbound; +} + +/** @internal */ +export const GetBandwidthStatisticsResponse$inboundSchema: z.ZodType< + GetBandwidthStatisticsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetBandwidthStatisticsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetBandwidthStatisticsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetBandwidthStatisticsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetBandwidthStatisticsResponse$outboundSchema: z.ZodType< + GetBandwidthStatisticsResponse$Outbound, + z.ZodTypeDef, + GetBandwidthStatisticsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetBandwidthStatisticsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetBandwidthStatisticsResponse$ { + /** @deprecated use `GetBandwidthStatisticsResponse$inboundSchema` instead. */ + export const inboundSchema = GetBandwidthStatisticsResponse$inboundSchema; + /** @deprecated use `GetBandwidthStatisticsResponse$outboundSchema` instead. */ + export const outboundSchema = GetBandwidthStatisticsResponse$outboundSchema; + /** @deprecated use `GetBandwidthStatisticsResponse$Outbound` instead. */ + export type Outbound = GetBandwidthStatisticsResponse$Outbound; } diff --git a/src/models/getbutlertasksop.ts b/src/models/getbutlertasksop.ts index fd0cdd68..8a312cb9 100644 --- a/src/models/getbutlertasksop.ts +++ b/src/models/getbutlertasksop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetButlerTasksButlerResponseBody extends Error { data$: GetButlerTasksButlerResponseBodyData; constructor(err: GetButlerTasksButlerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetButlerTasksButlerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetButlerTasksButlerResponseBody"; } } @@ -95,197 +94,305 @@ export type GetButlerTasksResponse = { }; /** @internal */ +export const GetButlerTasksErrors$inboundSchema: z.ZodType< + GetButlerTasksErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetButlerTasksErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetButlerTasksErrors$outboundSchema: z.ZodType< + GetButlerTasksErrors$Outbound, + z.ZodTypeDef, + GetButlerTasksErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetButlerTasksErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } - ); + /** @deprecated use `GetButlerTasksErrors$inboundSchema` instead. */ + export const inboundSchema = GetButlerTasksErrors$inboundSchema; + /** @deprecated use `GetButlerTasksErrors$outboundSchema` instead. */ + export const outboundSchema = GetButlerTasksErrors$outboundSchema; + /** @deprecated use `GetButlerTasksErrors$Outbound` instead. */ + export type Outbound = GetButlerTasksErrors$Outbound; } /** @internal */ -export namespace GetButlerTasksButlerResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetButlerTasksButlerResponseBody$inboundSchema: z.ZodType< + GetButlerTasksButlerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetButlerTasksErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetButlerTasksButlerResponseBody(remapped); + }); + +/** @internal */ +export type GetButlerTasksButlerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetButlerTasksButlerResponseBody$outboundSchema: z.ZodType< + GetButlerTasksButlerResponseBody$Outbound, + z.ZodTypeDef, + GetButlerTasksButlerResponseBody +> = z + .instanceof(GetButlerTasksButlerResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => GetButlerTasksErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => GetButlerTasksErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new GetButlerTasksButlerResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetButlerTasksButlerResponseBody - > = z - .instanceof(GetButlerTasksButlerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetButlerTasksErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetButlerTasksButlerResponseBody$ { + /** @deprecated use `GetButlerTasksButlerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetButlerTasksButlerResponseBody$inboundSchema; + /** @deprecated use `GetButlerTasksButlerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetButlerTasksButlerResponseBody$outboundSchema; + /** @deprecated use `GetButlerTasksButlerResponseBody$Outbound` instead. */ + export type Outbound = GetButlerTasksButlerResponseBody$Outbound; } /** @internal */ +export const ButlerTask$inboundSchema: z.ZodType = z.object({ + name: z.string().optional(), + interval: z.number().optional(), + scheduleRandomized: z.boolean().optional(), + enabled: z.boolean().optional(), + title: z.string().optional(), + description: z.string().optional(), +}); + +/** @internal */ +export type ButlerTask$Outbound = { + name?: string | undefined; + interval?: number | undefined; + scheduleRandomized?: boolean | undefined; + enabled?: boolean | undefined; + title?: string | undefined; + description?: string | undefined; +}; + +/** @internal */ +export const ButlerTask$outboundSchema: z.ZodType = + z.object({ + name: z.string().optional(), + interval: z.number().optional(), + scheduleRandomized: z.boolean().optional(), + enabled: z.boolean().optional(), + title: z.string().optional(), + description: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ButlerTask$ { - export const inboundSchema: z.ZodType = z.object({ - name: z.string().optional(), - interval: z.number().optional(), - scheduleRandomized: z.boolean().optional(), - enabled: z.boolean().optional(), - title: z.string().optional(), - description: z.string().optional(), - }); - - export type Outbound = { - name?: string | undefined; - interval?: number | undefined; - scheduleRandomized?: boolean | undefined; - enabled?: boolean | undefined; - title?: string | undefined; - description?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - name: z.string().optional(), - interval: z.number().optional(), - scheduleRandomized: z.boolean().optional(), - enabled: z.boolean().optional(), - title: z.string().optional(), - description: z.string().optional(), - }); + /** @deprecated use `ButlerTask$inboundSchema` instead. */ + export const inboundSchema = ButlerTask$inboundSchema; + /** @deprecated use `ButlerTask$outboundSchema` instead. */ + export const outboundSchema = ButlerTask$outboundSchema; + /** @deprecated use `ButlerTask$Outbound` instead. */ + export type Outbound = ButlerTask$Outbound; } /** @internal */ +export const ButlerTasks$inboundSchema: z.ZodType = z + .object({ + ButlerTask: z.array(z.lazy(() => ButlerTask$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + ButlerTask: "butlerTask", + }); + }); + +/** @internal */ +export type ButlerTasks$Outbound = { + ButlerTask?: Array | undefined; +}; + +/** @internal */ +export const ButlerTasks$outboundSchema: z.ZodType< + ButlerTasks$Outbound, + z.ZodTypeDef, + ButlerTasks +> = z + .object({ + butlerTask: z.array(z.lazy(() => ButlerTask$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + butlerTask: "ButlerTask", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace ButlerTasks$ { - export const inboundSchema: z.ZodType = z - .object({ - ButlerTask: z.array(z.lazy(() => ButlerTask$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - ButlerTask: "butlerTask", - }); - }); - - export type Outbound = { - ButlerTask?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - butlerTask: z.array(z.lazy(() => ButlerTask$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - butlerTask: "ButlerTask", - }); - }); + /** @deprecated use `ButlerTasks$inboundSchema` instead. */ + export const inboundSchema = ButlerTasks$inboundSchema; + /** @deprecated use `ButlerTasks$outboundSchema` instead. */ + export const outboundSchema = ButlerTasks$outboundSchema; + /** @deprecated use `ButlerTasks$Outbound` instead. */ + export type Outbound = ButlerTasks$Outbound; } /** @internal */ +export const GetButlerTasksResponseBody$inboundSchema: z.ZodType< + GetButlerTasksResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + ButlerTasks: z.lazy(() => ButlerTasks$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ButlerTasks: "butlerTasks", + }); + }); + +/** @internal */ +export type GetButlerTasksResponseBody$Outbound = { + ButlerTasks?: ButlerTasks$Outbound | undefined; +}; + +/** @internal */ +export const GetButlerTasksResponseBody$outboundSchema: z.ZodType< + GetButlerTasksResponseBody$Outbound, + z.ZodTypeDef, + GetButlerTasksResponseBody +> = z + .object({ + butlerTasks: z.lazy(() => ButlerTasks$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + butlerTasks: "ButlerTasks", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetButlerTasksResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - ButlerTasks: z.lazy(() => ButlerTasks$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ButlerTasks: "butlerTasks", - }); - }); - - export type Outbound = { - ButlerTasks?: ButlerTasks$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - butlerTasks: z.lazy(() => ButlerTasks$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - butlerTasks: "ButlerTasks", - }); - }); + /** @deprecated use `GetButlerTasksResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetButlerTasksResponseBody$inboundSchema; + /** @deprecated use `GetButlerTasksResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetButlerTasksResponseBody$outboundSchema; + /** @deprecated use `GetButlerTasksResponseBody$Outbound` instead. */ + export type Outbound = GetButlerTasksResponseBody$Outbound; } /** @internal */ +export const GetButlerTasksResponse$inboundSchema: z.ZodType< + GetButlerTasksResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetButlerTasksResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetButlerTasksResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetButlerTasksResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetButlerTasksResponse$outboundSchema: z.ZodType< + GetButlerTasksResponse$Outbound, + z.ZodTypeDef, + GetButlerTasksResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetButlerTasksResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetButlerTasksResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetButlerTasksResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetButlerTasksResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetButlerTasksResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetButlerTasksResponse$inboundSchema` instead. */ + export const inboundSchema = GetButlerTasksResponse$inboundSchema; + /** @deprecated use `GetButlerTasksResponse$outboundSchema` instead. */ + export const outboundSchema = GetButlerTasksResponse$outboundSchema; + /** @deprecated use `GetButlerTasksResponse$Outbound` instead. */ + export type Outbound = GetButlerTasksResponse$Outbound; } diff --git a/src/models/getcompanionsdataop.ts b/src/models/getcompanionsdataop.ts new file mode 100644 index 00000000..8a09987a --- /dev/null +++ b/src/models/getcompanionsdataop.ts @@ -0,0 +1,303 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const GetCompanionsDataOpServerList = ["https://plex.tv/api/v2"] as const; + +export type GetCompanionsDataErrors = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export type GetCompanionsDataResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export class GetCompanionsDataResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: GetCompanionsDataResponseBodyData; + + constructor(err: GetCompanionsDataResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "GetCompanionsDataResponseBody"; + } +} + +export type ResponseBody = { + identifier: string; + baseURL: string; + title: string; + linkURL: string; + provides: string; + /** + * The plex authtoken used to identify with + */ + token: string; +}; + +export type GetCompanionsDataResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * Companions Data + */ + responseBodies?: Array | undefined; +}; + +/** @internal */ +export const GetCompanionsDataErrors$inboundSchema: z.ZodType< + GetCompanionsDataErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetCompanionsDataErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetCompanionsDataErrors$outboundSchema: z.ZodType< + GetCompanionsDataErrors$Outbound, + z.ZodTypeDef, + GetCompanionsDataErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetCompanionsDataErrors$ { + /** @deprecated use `GetCompanionsDataErrors$inboundSchema` instead. */ + export const inboundSchema = GetCompanionsDataErrors$inboundSchema; + /** @deprecated use `GetCompanionsDataErrors$outboundSchema` instead. */ + export const outboundSchema = GetCompanionsDataErrors$outboundSchema; + /** @deprecated use `GetCompanionsDataErrors$Outbound` instead. */ + export type Outbound = GetCompanionsDataErrors$Outbound; +} + +/** @internal */ +export const GetCompanionsDataResponseBody$inboundSchema: z.ZodType< + GetCompanionsDataResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetCompanionsDataErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetCompanionsDataResponseBody(remapped); + }); + +/** @internal */ +export type GetCompanionsDataResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetCompanionsDataResponseBody$outboundSchema: z.ZodType< + GetCompanionsDataResponseBody$Outbound, + z.ZodTypeDef, + GetCompanionsDataResponseBody +> = z + .instanceof(GetCompanionsDataResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetCompanionsDataErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetCompanionsDataResponseBody$ { + /** @deprecated use `GetCompanionsDataResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetCompanionsDataResponseBody$inboundSchema; + /** @deprecated use `GetCompanionsDataResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetCompanionsDataResponseBody$outboundSchema; + /** @deprecated use `GetCompanionsDataResponseBody$Outbound` instead. */ + export type Outbound = GetCompanionsDataResponseBody$Outbound; +} + +/** @internal */ +export const ResponseBody$inboundSchema: z.ZodType = z.object({ + identifier: z.string(), + baseURL: z.string(), + title: z.string(), + linkURL: z.string(), + provides: z.string(), + token: z.string(), +}); + +/** @internal */ +export type ResponseBody$Outbound = { + identifier: string; + baseURL: string; + title: string; + linkURL: string; + provides: string; + token: string; +}; + +/** @internal */ +export const ResponseBody$outboundSchema: z.ZodType< + ResponseBody$Outbound, + z.ZodTypeDef, + ResponseBody +> = z.object({ + identifier: z.string(), + baseURL: z.string(), + title: z.string(), + linkURL: z.string(), + provides: z.string(), + token: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ResponseBody$ { + /** @deprecated use `ResponseBody$inboundSchema` instead. */ + export const inboundSchema = ResponseBody$inboundSchema; + /** @deprecated use `ResponseBody$outboundSchema` instead. */ + export const outboundSchema = ResponseBody$outboundSchema; + /** @deprecated use `ResponseBody$Outbound` instead. */ + export type Outbound = ResponseBody$Outbound; +} + +/** @internal */ +export const GetCompanionsDataResponse$inboundSchema: z.ZodType< + GetCompanionsDataResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + responseBodies: z.array(z.lazy(() => ResponseBody$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetCompanionsDataResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + responseBodies?: Array | undefined; +}; + +/** @internal */ +export const GetCompanionsDataResponse$outboundSchema: z.ZodType< + GetCompanionsDataResponse$Outbound, + z.ZodTypeDef, + GetCompanionsDataResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + responseBodies: z.array(z.lazy(() => ResponseBody$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetCompanionsDataResponse$ { + /** @deprecated use `GetCompanionsDataResponse$inboundSchema` instead. */ + export const inboundSchema = GetCompanionsDataResponse$inboundSchema; + /** @deprecated use `GetCompanionsDataResponse$outboundSchema` instead. */ + export const outboundSchema = GetCompanionsDataResponse$outboundSchema; + /** @deprecated use `GetCompanionsDataResponse$Outbound` instead. */ + export type Outbound = GetCompanionsDataResponse$Outbound; +} diff --git a/src/models/getdevicesop.ts b/src/models/getdevicesop.ts index 116baea6..f6f9e574 100644 --- a/src/models/getdevicesop.ts +++ b/src/models/getdevicesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetDevicesServerResponseBody extends Error { data$: GetDevicesServerResponseBodyData; constructor(err: GetDevicesServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetDevicesServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetDevicesServerResponseBody"; } } @@ -96,193 +95,308 @@ export type GetDevicesResponse = { }; /** @internal */ +export const GetDevicesErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetDevicesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetDevicesErrors$outboundSchema: z.ZodType< + GetDevicesErrors$Outbound, + z.ZodTypeDef, + GetDevicesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetDevicesErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetDevicesErrors$inboundSchema` instead. */ + export const inboundSchema = GetDevicesErrors$inboundSchema; + /** @deprecated use `GetDevicesErrors$outboundSchema` instead. */ + export const outboundSchema = GetDevicesErrors$outboundSchema; + /** @deprecated use `GetDevicesErrors$Outbound` instead. */ + export type Outbound = GetDevicesErrors$Outbound; } /** @internal */ +export const GetDevicesServerResponseBody$inboundSchema: z.ZodType< + GetDevicesServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetDevicesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetDevicesServerResponseBody(remapped); + }); + +/** @internal */ +export type GetDevicesServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetDevicesServerResponseBody$outboundSchema: z.ZodType< + GetDevicesServerResponseBody$Outbound, + z.ZodTypeDef, + GetDevicesServerResponseBody +> = z + .instanceof(GetDevicesServerResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetDevicesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetDevicesServerResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetDevicesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetDevicesServerResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetDevicesServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetDevicesErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetDevicesServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetDevicesServerResponseBody$inboundSchema; + /** @deprecated use `GetDevicesServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetDevicesServerResponseBody$outboundSchema; + /** @deprecated use `GetDevicesServerResponseBody$Outbound` instead. */ + export type Outbound = GetDevicesServerResponseBody$Outbound; } /** @internal */ +export const Device$inboundSchema: z.ZodType = z.object({ + id: z.number().optional(), + name: z.string().optional(), + platform: z.string().optional(), + clientIdentifier: z.string().optional(), + createdAt: z.number().optional(), +}); + +/** @internal */ +export type Device$Outbound = { + id?: number | undefined; + name?: string | undefined; + platform?: string | undefined; + clientIdentifier?: string | undefined; + createdAt?: number | undefined; +}; + +/** @internal */ +export const Device$outboundSchema: z.ZodType = z.object({ + id: z.number().optional(), + name: z.string().optional(), + platform: z.string().optional(), + clientIdentifier: z.string().optional(), + createdAt: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Device$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - name: z.string().optional(), - platform: z.string().optional(), - clientIdentifier: z.string().optional(), - createdAt: z.number().optional(), - }); - - export type Outbound = { - id?: number | undefined; - name?: string | undefined; - platform?: string | undefined; - clientIdentifier?: string | undefined; - createdAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - name: z.string().optional(), - platform: z.string().optional(), - clientIdentifier: z.string().optional(), - createdAt: z.number().optional(), - }); + /** @deprecated use `Device$inboundSchema` instead. */ + export const inboundSchema = Device$inboundSchema; + /** @deprecated use `Device$outboundSchema` instead. */ + export const outboundSchema = Device$outboundSchema; + /** @deprecated use `Device$Outbound` instead. */ + export type Outbound = Device$Outbound; } /** @internal */ +export const GetDevicesMediaContainer$inboundSchema: z.ZodType< + GetDevicesMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + identifier: z.string().optional(), + Device: z.array(z.lazy(() => Device$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Device: "device", + }); + }); + +/** @internal */ +export type GetDevicesMediaContainer$Outbound = { + size?: number | undefined; + identifier?: string | undefined; + Device?: Array | undefined; +}; + +/** @internal */ +export const GetDevicesMediaContainer$outboundSchema: z.ZodType< + GetDevicesMediaContainer$Outbound, + z.ZodTypeDef, + GetDevicesMediaContainer +> = z + .object({ + size: z.number().optional(), + identifier: z.string().optional(), + device: z.array(z.lazy(() => Device$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + device: "Device", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetDevicesMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - identifier: z.string().optional(), - Device: z.array(z.lazy(() => Device$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Device: "device", - }); - }); - - export type Outbound = { - size?: number | undefined; - identifier?: string | undefined; - Device?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - identifier: z.string().optional(), - device: z.array(z.lazy(() => Device$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - device: "Device", - }); - }); + /** @deprecated use `GetDevicesMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetDevicesMediaContainer$inboundSchema; + /** @deprecated use `GetDevicesMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetDevicesMediaContainer$outboundSchema; + /** @deprecated use `GetDevicesMediaContainer$Outbound` instead. */ + export type Outbound = GetDevicesMediaContainer$Outbound; } /** @internal */ +export const GetDevicesResponseBody$inboundSchema: z.ZodType< + GetDevicesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetDevicesMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetDevicesResponseBody$Outbound = { + MediaContainer?: GetDevicesMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetDevicesResponseBody$outboundSchema: z.ZodType< + GetDevicesResponseBody$Outbound, + z.ZodTypeDef, + GetDevicesResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetDevicesMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetDevicesResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetDevicesMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetDevicesMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetDevicesMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetDevicesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetDevicesResponseBody$inboundSchema; + /** @deprecated use `GetDevicesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetDevicesResponseBody$outboundSchema; + /** @deprecated use `GetDevicesResponseBody$Outbound` instead. */ + export type Outbound = GetDevicesResponseBody$Outbound; } /** @internal */ +export const GetDevicesResponse$inboundSchema: z.ZodType< + GetDevicesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetDevicesResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetDevicesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetDevicesResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetDevicesResponse$outboundSchema: z.ZodType< + GetDevicesResponse$Outbound, + z.ZodTypeDef, + GetDevicesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetDevicesResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetDevicesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetDevicesResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetDevicesResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetDevicesResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetDevicesResponse$inboundSchema` instead. */ + export const inboundSchema = GetDevicesResponse$inboundSchema; + /** @deprecated use `GetDevicesResponse$outboundSchema` instead. */ + export const outboundSchema = GetDevicesResponse$outboundSchema; + /** @deprecated use `GetDevicesResponse$Outbound` instead. */ + export type Outbound = GetDevicesResponse$Outbound; } diff --git a/src/models/getfilehashop.ts b/src/models/getfilehashop.ts index 9bce0d59..34412238 100644 --- a/src/models/getfilehashop.ts +++ b/src/models/getfilehashop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -47,7 +47,11 @@ export class GetFileHashResponseBody extends Error { data$: GetFileHashResponseBodyData; constructor(err: GetFileHashResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -57,11 +61,6 @@ export class GetFileHashResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetFileHashResponseBody"; } } @@ -82,121 +81,202 @@ export type GetFileHashResponse = { }; /** @internal */ +export const GetFileHashRequest$inboundSchema: z.ZodType< + GetFileHashRequest, + z.ZodTypeDef, + unknown +> = z.object({ + url: z.string(), + type: z.number().optional(), +}); + +/** @internal */ +export type GetFileHashRequest$Outbound = { + url: string; + type?: number | undefined; +}; + +/** @internal */ +export const GetFileHashRequest$outboundSchema: z.ZodType< + GetFileHashRequest$Outbound, + z.ZodTypeDef, + GetFileHashRequest +> = z.object({ + url: z.string(), + type: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetFileHashRequest$ { - export const inboundSchema: z.ZodType = z.object({ - url: z.string(), - type: z.number().optional(), - }); - - export type Outbound = { - url: string; - type?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - url: z.string(), - type: z.number().optional(), - }); + /** @deprecated use `GetFileHashRequest$inboundSchema` instead. */ + export const inboundSchema = GetFileHashRequest$inboundSchema; + /** @deprecated use `GetFileHashRequest$outboundSchema` instead. */ + export const outboundSchema = GetFileHashRequest$outboundSchema; + /** @deprecated use `GetFileHashRequest$Outbound` instead. */ + export type Outbound = GetFileHashRequest$Outbound; } /** @internal */ +export const GetFileHashErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetFileHashErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetFileHashErrors$outboundSchema: z.ZodType< + GetFileHashErrors$Outbound, + z.ZodTypeDef, + GetFileHashErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetFileHashErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetFileHashErrors$inboundSchema` instead. */ + export const inboundSchema = GetFileHashErrors$inboundSchema; + /** @deprecated use `GetFileHashErrors$outboundSchema` instead. */ + export const outboundSchema = GetFileHashErrors$outboundSchema; + /** @deprecated use `GetFileHashErrors$Outbound` instead. */ + export type Outbound = GetFileHashErrors$Outbound; } /** @internal */ +export const GetFileHashResponseBody$inboundSchema: z.ZodType< + GetFileHashResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetFileHashErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetFileHashResponseBody(remapped); + }); + +/** @internal */ +export type GetFileHashResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetFileHashResponseBody$outboundSchema: z.ZodType< + GetFileHashResponseBody$Outbound, + z.ZodTypeDef, + GetFileHashResponseBody +> = z + .instanceof(GetFileHashResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetFileHashErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetFileHashResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetFileHashErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetFileHashResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetFileHashResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetFileHashErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetFileHashResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetFileHashResponseBody$inboundSchema; + /** @deprecated use `GetFileHashResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetFileHashResponseBody$outboundSchema; + /** @deprecated use `GetFileHashResponseBody$Outbound` instead. */ + export type Outbound = GetFileHashResponseBody$Outbound; } /** @internal */ +export const GetFileHashResponse$inboundSchema: z.ZodType< + GetFileHashResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetFileHashResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const GetFileHashResponse$outboundSchema: z.ZodType< + GetFileHashResponse$Outbound, + z.ZodTypeDef, + GetFileHashResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetFileHashResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetFileHashResponse$inboundSchema` instead. */ + export const inboundSchema = GetFileHashResponse$inboundSchema; + /** @deprecated use `GetFileHashResponse$outboundSchema` instead. */ + export const outboundSchema = GetFileHashResponse$outboundSchema; + /** @deprecated use `GetFileHashResponse$Outbound` instead. */ + export type Outbound = GetFileHashResponse$Outbound; } diff --git a/src/models/getgeodataop.ts b/src/models/getgeodataop.ts new file mode 100644 index 00000000..b18661d1 --- /dev/null +++ b/src/models/getgeodataop.ts @@ -0,0 +1,378 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const GetGeoDataOpServerList = ["https://plex.tv/api/v2"] as const; + +export type GetGeoDataErrors = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export type GetGeoDataResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export class GetGeoDataResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: GetGeoDataResponseBodyData; + + constructor(err: GetGeoDataResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "GetGeoDataResponseBody"; + } +} + +/** + * Geo location data + */ +export type GetGeoDataGeoData = { + /** + * The ISO 3166-1 alpha-2 code of the country. + */ + code: string; + /** + * The continent code where the country is located. + */ + continentCode: string; + /** + * The official name of the country. + */ + country: string; + /** + * The name of the city. + */ + city: string; + /** + * Indicates if the country is a member of the European Union. + */ + europeanUnionMember?: boolean | undefined; + /** + * The time zone of the country. + */ + timeZone: string; + /** + * The postal code of the location. + */ + postalCode: number; + /** + * Indicates if the country has privacy restrictions. + */ + inPrivacyRestrictedCountry?: boolean | undefined; + /** + * Indicates if the region has privacy restrictions. + */ + inPrivacyRestrictedRegion?: boolean | undefined; + /** + * The name of the primary administrative subdivision. + */ + subdivisions: string; + /** + * The geographical coordinates (latitude, longitude) of the location. + */ + coordinates: string; +}; + +export type GetGeoDataResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * Gets the geo location data of the user + */ + geoData?: GetGeoDataGeoData | undefined; +}; + +/** @internal */ +export const GetGeoDataErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetGeoDataErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetGeoDataErrors$outboundSchema: z.ZodType< + GetGeoDataErrors$Outbound, + z.ZodTypeDef, + GetGeoDataErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetGeoDataErrors$ { + /** @deprecated use `GetGeoDataErrors$inboundSchema` instead. */ + export const inboundSchema = GetGeoDataErrors$inboundSchema; + /** @deprecated use `GetGeoDataErrors$outboundSchema` instead. */ + export const outboundSchema = GetGeoDataErrors$outboundSchema; + /** @deprecated use `GetGeoDataErrors$Outbound` instead. */ + export type Outbound = GetGeoDataErrors$Outbound; +} + +/** @internal */ +export const GetGeoDataResponseBody$inboundSchema: z.ZodType< + GetGeoDataResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetGeoDataErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetGeoDataResponseBody(remapped); + }); + +/** @internal */ +export type GetGeoDataResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetGeoDataResponseBody$outboundSchema: z.ZodType< + GetGeoDataResponseBody$Outbound, + z.ZodTypeDef, + GetGeoDataResponseBody +> = z + .instanceof(GetGeoDataResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetGeoDataErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetGeoDataResponseBody$ { + /** @deprecated use `GetGeoDataResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetGeoDataResponseBody$inboundSchema; + /** @deprecated use `GetGeoDataResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetGeoDataResponseBody$outboundSchema; + /** @deprecated use `GetGeoDataResponseBody$Outbound` instead. */ + export type Outbound = GetGeoDataResponseBody$Outbound; +} + +/** @internal */ +export const GetGeoDataGeoData$inboundSchema: z.ZodType = + z + .object({ + code: z.string(), + continent_code: z.string(), + country: z.string(), + city: z.string(), + european_union_member: z.boolean(), + time_zone: z.string(), + postal_code: z.number().int(), + in_privacy_restricted_country: z.boolean(), + in_privacy_restricted_region: z.boolean(), + subdivisions: z.string(), + coordinates: z.string(), + }) + .transform((v) => { + return remap$(v, { + continent_code: "continentCode", + european_union_member: "europeanUnionMember", + time_zone: "timeZone", + postal_code: "postalCode", + in_privacy_restricted_country: "inPrivacyRestrictedCountry", + in_privacy_restricted_region: "inPrivacyRestrictedRegion", + }); + }); + +/** @internal */ +export type GetGeoDataGeoData$Outbound = { + code: string; + continent_code: string; + country: string; + city: string; + european_union_member: boolean; + time_zone: string; + postal_code: number; + in_privacy_restricted_country: boolean; + in_privacy_restricted_region: boolean; + subdivisions: string; + coordinates: string; +}; + +/** @internal */ +export const GetGeoDataGeoData$outboundSchema: z.ZodType< + GetGeoDataGeoData$Outbound, + z.ZodTypeDef, + GetGeoDataGeoData +> = z + .object({ + code: z.string(), + continentCode: z.string(), + country: z.string(), + city: z.string(), + europeanUnionMember: z.boolean().default(false), + timeZone: z.string(), + postalCode: z.number().int(), + inPrivacyRestrictedCountry: z.boolean().default(false), + inPrivacyRestrictedRegion: z.boolean().default(false), + subdivisions: z.string(), + coordinates: z.string(), + }) + .transform((v) => { + return remap$(v, { + continentCode: "continent_code", + europeanUnionMember: "european_union_member", + timeZone: "time_zone", + postalCode: "postal_code", + inPrivacyRestrictedCountry: "in_privacy_restricted_country", + inPrivacyRestrictedRegion: "in_privacy_restricted_region", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetGeoDataGeoData$ { + /** @deprecated use `GetGeoDataGeoData$inboundSchema` instead. */ + export const inboundSchema = GetGeoDataGeoData$inboundSchema; + /** @deprecated use `GetGeoDataGeoData$outboundSchema` instead. */ + export const outboundSchema = GetGeoDataGeoData$outboundSchema; + /** @deprecated use `GetGeoDataGeoData$Outbound` instead. */ + export type Outbound = GetGeoDataGeoData$Outbound; +} + +/** @internal */ +export const GetGeoDataResponse$inboundSchema: z.ZodType< + GetGeoDataResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + GeoData: z.lazy(() => GetGeoDataGeoData$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + GeoData: "geoData", + }); + }); + +/** @internal */ +export type GetGeoDataResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + GeoData?: GetGeoDataGeoData$Outbound | undefined; +}; + +/** @internal */ +export const GetGeoDataResponse$outboundSchema: z.ZodType< + GetGeoDataResponse$Outbound, + z.ZodTypeDef, + GetGeoDataResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + geoData: z.lazy(() => GetGeoDataGeoData$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + geoData: "GeoData", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetGeoDataResponse$ { + /** @deprecated use `GetGeoDataResponse$inboundSchema` instead. */ + export const inboundSchema = GetGeoDataResponse$inboundSchema; + /** @deprecated use `GetGeoDataResponse$outboundSchema` instead. */ + export const outboundSchema = GetGeoDataResponse$outboundSchema; + /** @deprecated use `GetGeoDataResponse$Outbound` instead. */ + export type Outbound = GetGeoDataResponse$Outbound; +} diff --git a/src/models/getglobalhubsop.ts b/src/models/getglobalhubsop.ts index 5b04f2bf..bc4ded5d 100644 --- a/src/models/getglobalhubsop.ts +++ b/src/models/getglobalhubsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -55,7 +55,11 @@ export class GetGlobalHubsHubsResponseBody extends Error { data$: GetGlobalHubsHubsResponseBodyData; constructor(err: GetGlobalHubsHubsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -65,11 +69,6 @@ export class GetGlobalHubsHubsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetGlobalHubsHubsResponseBody"; } } @@ -142,319 +141,486 @@ export type GetGlobalHubsResponse = { }; /** @internal */ +export const OnlyTransient$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(OnlyTransient); + +/** @internal */ +export const OnlyTransient$outboundSchema: z.ZodNativeEnum = + OnlyTransient$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace OnlyTransient$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(OnlyTransient); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `OnlyTransient$inboundSchema` instead. */ + export const inboundSchema = OnlyTransient$inboundSchema; + /** @deprecated use `OnlyTransient$outboundSchema` instead. */ + export const outboundSchema = OnlyTransient$outboundSchema; } /** @internal */ +export const GetGlobalHubsRequest$inboundSchema: z.ZodType< + GetGlobalHubsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + count: z.number().optional(), + onlyTransient: OnlyTransient$inboundSchema.optional(), +}); + +/** @internal */ +export type GetGlobalHubsRequest$Outbound = { + count?: number | undefined; + onlyTransient?: number | undefined; +}; + +/** @internal */ +export const GetGlobalHubsRequest$outboundSchema: z.ZodType< + GetGlobalHubsRequest$Outbound, + z.ZodTypeDef, + GetGlobalHubsRequest +> = z.object({ + count: z.number().optional(), + onlyTransient: OnlyTransient$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetGlobalHubsRequest$ { - export const inboundSchema: z.ZodType = z.object({ - count: z.number().optional(), - onlyTransient: OnlyTransient$.inboundSchema.optional(), - }); - - export type Outbound = { - count?: number | undefined; - onlyTransient?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - count: z.number().optional(), - onlyTransient: OnlyTransient$.outboundSchema.optional(), - } - ); + /** @deprecated use `GetGlobalHubsRequest$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsRequest$inboundSchema; + /** @deprecated use `GetGlobalHubsRequest$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsRequest$outboundSchema; + /** @deprecated use `GetGlobalHubsRequest$Outbound` instead. */ + export type Outbound = GetGlobalHubsRequest$Outbound; } /** @internal */ +export const GetGlobalHubsErrors$inboundSchema: z.ZodType< + GetGlobalHubsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetGlobalHubsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetGlobalHubsErrors$outboundSchema: z.ZodType< + GetGlobalHubsErrors$Outbound, + z.ZodTypeDef, + GetGlobalHubsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetGlobalHubsErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetGlobalHubsErrors$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsErrors$inboundSchema; + /** @deprecated use `GetGlobalHubsErrors$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsErrors$outboundSchema; + /** @deprecated use `GetGlobalHubsErrors$Outbound` instead. */ + export type Outbound = GetGlobalHubsErrors$Outbound; } /** @internal */ -export namespace GetGlobalHubsHubsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetGlobalHubsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetGlobalHubsHubsResponseBody(remapped); +export const GetGlobalHubsHubsResponseBody$inboundSchema: z.ZodType< + GetGlobalHubsHubsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetGlobalHubsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new GetGlobalHubsHubsResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type GetGlobalHubsHubsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetGlobalHubsHubsResponseBody$outboundSchema: z.ZodType< + GetGlobalHubsHubsResponseBody$Outbound, + z.ZodTypeDef, + GetGlobalHubsHubsResponseBody +> = z + .instanceof(GetGlobalHubsHubsResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(GetGlobalHubsHubsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetGlobalHubsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => GetGlobalHubsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetGlobalHubsHubsResponseBody$ { + /** @deprecated use `GetGlobalHubsHubsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsHubsResponseBody$inboundSchema; + /** @deprecated use `GetGlobalHubsHubsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsHubsResponseBody$outboundSchema; + /** @deprecated use `GetGlobalHubsHubsResponseBody$Outbound` instead. */ + export type Outbound = GetGlobalHubsHubsResponseBody$Outbound; } /** @internal */ +export const GetGlobalHubsMetadata$inboundSchema: z.ZodType< + GetGlobalHubsMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + titleSort: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + icon: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** @internal */ +export type GetGlobalHubsMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + type?: string | undefined; + title?: string | undefined; + titleSort?: string | undefined; + summary?: string | undefined; + smart?: boolean | undefined; + playlistType?: string | undefined; + composite?: string | undefined; + icon?: string | undefined; + viewCount?: number | undefined; + lastViewedAt?: number | undefined; + duration?: number | undefined; + leafCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; +}; + +/** @internal */ +export const GetGlobalHubsMetadata$outboundSchema: z.ZodType< + GetGlobalHubsMetadata$Outbound, + z.ZodTypeDef, + GetGlobalHubsMetadata +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + titleSort: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + icon: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetGlobalHubsMetadata$ { - export const inboundSchema: z.ZodType = z.object({ - ratingKey: z.string().optional(), + /** @deprecated use `GetGlobalHubsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsMetadata$inboundSchema; + /** @deprecated use `GetGlobalHubsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsMetadata$outboundSchema; + /** @deprecated use `GetGlobalHubsMetadata$Outbound` instead. */ + export type Outbound = GetGlobalHubsMetadata$Outbound; +} + +/** @internal */ +export const Hub$inboundSchema: z.ZodType = z + .object({ + hubKey: z.string().optional(), key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), title: z.string().optional(), - titleSort: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - icon: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), + type: z.string().optional(), + hubIdentifier: z.string().optional(), + context: z.string().optional(), + size: z.number().int().optional(), + more: z.boolean().optional(), + style: z.string().optional(), + promoted: z.boolean().optional(), + Metadata: z.array(z.lazy(() => GetGlobalHubsMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); }); - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - type?: string | undefined; - title?: string | undefined; - titleSort?: string | undefined; - summary?: string | undefined; - smart?: boolean | undefined; - playlistType?: string | undefined; - composite?: string | undefined; - icon?: string | undefined; - viewCount?: number | undefined; - lastViewedAt?: number | undefined; - duration?: number | undefined; - leafCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - titleSort: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - icon: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - }); -} +/** @internal */ +export type Hub$Outbound = { + hubKey?: string | undefined; + key?: string | undefined; + title?: string | undefined; + type?: string | undefined; + hubIdentifier?: string | undefined; + context?: string | undefined; + size?: number | undefined; + more?: boolean | undefined; + style?: string | undefined; + promoted?: boolean | undefined; + Metadata?: Array | undefined; +}; /** @internal */ +export const Hub$outboundSchema: z.ZodType = z + .object({ + hubKey: z.string().optional(), + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), + hubIdentifier: z.string().optional(), + context: z.string().optional(), + size: z.number().int().optional(), + more: z.boolean().optional(), + style: z.string().optional(), + promoted: z.boolean().optional(), + metadata: z.array(z.lazy(() => GetGlobalHubsMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Hub$ { - export const inboundSchema: z.ZodType = z - .object({ - hubKey: z.string().optional(), - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - hubIdentifier: z.string().optional(), - context: z.string().optional(), - size: z.number().int().optional(), - more: z.boolean().optional(), - style: z.string().optional(), - promoted: z.boolean().optional(), - Metadata: z.array(z.lazy(() => GetGlobalHubsMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - hubKey?: string | undefined; - key?: string | undefined; - title?: string | undefined; - type?: string | undefined; - hubIdentifier?: string | undefined; - context?: string | undefined; - size?: number | undefined; - more?: boolean | undefined; - style?: string | undefined; - promoted?: boolean | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - hubKey: z.string().optional(), - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - hubIdentifier: z.string().optional(), - context: z.string().optional(), - size: z.number().int().optional(), - more: z.boolean().optional(), - style: z.string().optional(), - promoted: z.boolean().optional(), - metadata: z.array(z.lazy(() => GetGlobalHubsMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `Hub$inboundSchema` instead. */ + export const inboundSchema = Hub$inboundSchema; + /** @deprecated use `Hub$outboundSchema` instead. */ + export const outboundSchema = Hub$outboundSchema; + /** @deprecated use `Hub$Outbound` instead. */ + export type Outbound = Hub$Outbound; } /** @internal */ +export const GetGlobalHubsMediaContainer$inboundSchema: z.ZodType< + GetGlobalHubsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + Hub: z.array(z.lazy(() => Hub$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Hub: "hub", + }); + }); + +/** @internal */ +export type GetGlobalHubsMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + identifier?: string | undefined; + Hub?: Array | undefined; +}; + +/** @internal */ +export const GetGlobalHubsMediaContainer$outboundSchema: z.ZodType< + GetGlobalHubsMediaContainer$Outbound, + z.ZodTypeDef, + GetGlobalHubsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + hub: z.array(z.lazy(() => Hub$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + hub: "Hub", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetGlobalHubsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - Hub: z.array(z.lazy(() => Hub$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Hub: "hub", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - identifier?: string | undefined; - Hub?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - hub: z.array(z.lazy(() => Hub$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - hub: "Hub", - }); - }); + /** @deprecated use `GetGlobalHubsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsMediaContainer$inboundSchema; + /** @deprecated use `GetGlobalHubsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsMediaContainer$outboundSchema; + /** @deprecated use `GetGlobalHubsMediaContainer$Outbound` instead. */ + export type Outbound = GetGlobalHubsMediaContainer$Outbound; } /** @internal */ +export const GetGlobalHubsResponseBody$inboundSchema: z.ZodType< + GetGlobalHubsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetGlobalHubsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetGlobalHubsResponseBody$Outbound = { + MediaContainer?: GetGlobalHubsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetGlobalHubsResponseBody$outboundSchema: z.ZodType< + GetGlobalHubsResponseBody$Outbound, + z.ZodTypeDef, + GetGlobalHubsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetGlobalHubsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetGlobalHubsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetGlobalHubsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetGlobalHubsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetGlobalHubsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetGlobalHubsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsResponseBody$inboundSchema; + /** @deprecated use `GetGlobalHubsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsResponseBody$outboundSchema; + /** @deprecated use `GetGlobalHubsResponseBody$Outbound` instead. */ + export type Outbound = GetGlobalHubsResponseBody$Outbound; } /** @internal */ +export const GetGlobalHubsResponse$inboundSchema: z.ZodType< + GetGlobalHubsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetGlobalHubsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetGlobalHubsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetGlobalHubsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetGlobalHubsResponse$outboundSchema: z.ZodType< + GetGlobalHubsResponse$Outbound, + z.ZodTypeDef, + GetGlobalHubsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetGlobalHubsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetGlobalHubsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetGlobalHubsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetGlobalHubsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetGlobalHubsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetGlobalHubsResponse$inboundSchema` instead. */ + export const inboundSchema = GetGlobalHubsResponse$inboundSchema; + /** @deprecated use `GetGlobalHubsResponse$outboundSchema` instead. */ + export const outboundSchema = GetGlobalHubsResponse$outboundSchema; + /** @deprecated use `GetGlobalHubsResponse$Outbound` instead. */ + export type Outbound = GetGlobalHubsResponse$Outbound; } diff --git a/src/models/gethomedataop.ts b/src/models/gethomedataop.ts index 2cddc69e..8b155478 100644 --- a/src/models/gethomedataop.ts +++ b/src/models/gethomedataop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetHomeDataPlexResponseBody extends Error { data$: GetHomeDataPlexResponseBodyData; constructor(err: GetHomeDataPlexResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetHomeDataPlexResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetHomeDataPlexResponseBody"; } } @@ -87,138 +86,217 @@ export type GetHomeDataResponse = { }; /** @internal */ +export const GetHomeDataErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetHomeDataErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetHomeDataErrors$outboundSchema: z.ZodType< + GetHomeDataErrors$Outbound, + z.ZodTypeDef, + GetHomeDataErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetHomeDataErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetHomeDataErrors$inboundSchema` instead. */ + export const inboundSchema = GetHomeDataErrors$inboundSchema; + /** @deprecated use `GetHomeDataErrors$outboundSchema` instead. */ + export const outboundSchema = GetHomeDataErrors$outboundSchema; + /** @deprecated use `GetHomeDataErrors$Outbound` instead. */ + export type Outbound = GetHomeDataErrors$Outbound; } /** @internal */ +export const GetHomeDataPlexResponseBody$inboundSchema: z.ZodType< + GetHomeDataPlexResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetHomeDataErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetHomeDataPlexResponseBody(remapped); + }); + +/** @internal */ +export type GetHomeDataPlexResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetHomeDataPlexResponseBody$outboundSchema: z.ZodType< + GetHomeDataPlexResponseBody$Outbound, + z.ZodTypeDef, + GetHomeDataPlexResponseBody +> = z + .instanceof(GetHomeDataPlexResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetHomeDataErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetHomeDataPlexResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetHomeDataErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetHomeDataPlexResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetHomeDataPlexResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetHomeDataErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetHomeDataPlexResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetHomeDataPlexResponseBody$inboundSchema; + /** @deprecated use `GetHomeDataPlexResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetHomeDataPlexResponseBody$outboundSchema; + /** @deprecated use `GetHomeDataPlexResponseBody$Outbound` instead. */ + export type Outbound = GetHomeDataPlexResponseBody$Outbound; } /** @internal */ +export const GetHomeDataResponseBody$inboundSchema: z.ZodType< + GetHomeDataResponseBody, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().optional(), + name: z.string().optional(), + guestUserID: z.number().optional(), + guestUserUUID: z.string().optional(), + guestEnabled: z.boolean().optional(), + subscription: z.boolean().optional(), +}); + +/** @internal */ +export type GetHomeDataResponseBody$Outbound = { + id?: number | undefined; + name?: string | undefined; + guestUserID?: number | undefined; + guestUserUUID?: string | undefined; + guestEnabled?: boolean | undefined; + subscription?: boolean | undefined; +}; + +/** @internal */ +export const GetHomeDataResponseBody$outboundSchema: z.ZodType< + GetHomeDataResponseBody$Outbound, + z.ZodTypeDef, + GetHomeDataResponseBody +> = z.object({ + id: z.number().optional(), + name: z.string().optional(), + guestUserID: z.number().optional(), + guestUserUUID: z.string().optional(), + guestEnabled: z.boolean().optional(), + subscription: z.boolean().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetHomeDataResponseBody$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().optional(), - name: z.string().optional(), - guestUserID: z.number().optional(), - guestUserUUID: z.string().optional(), - guestEnabled: z.boolean().optional(), - subscription: z.boolean().optional(), - }); - - export type Outbound = { - id?: number | undefined; - name?: string | undefined; - guestUserID?: number | undefined; - guestUserUUID?: string | undefined; - guestEnabled?: boolean | undefined; - subscription?: boolean | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().optional(), - name: z.string().optional(), - guestUserID: z.number().optional(), - guestUserUUID: z.string().optional(), - guestEnabled: z.boolean().optional(), - subscription: z.boolean().optional(), - }); + /** @deprecated use `GetHomeDataResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetHomeDataResponseBody$inboundSchema; + /** @deprecated use `GetHomeDataResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetHomeDataResponseBody$outboundSchema; + /** @deprecated use `GetHomeDataResponseBody$Outbound` instead. */ + export type Outbound = GetHomeDataResponseBody$Outbound; } /** @internal */ +export const GetHomeDataResponse$inboundSchema: z.ZodType< + GetHomeDataResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetHomeDataResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetHomeDataResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetHomeDataResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetHomeDataResponse$outboundSchema: z.ZodType< + GetHomeDataResponse$Outbound, + z.ZodTypeDef, + GetHomeDataResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetHomeDataResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetHomeDataResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetHomeDataResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetHomeDataResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetHomeDataResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetHomeDataResponse$inboundSchema` instead. */ + export const inboundSchema = GetHomeDataResponse$inboundSchema; + /** @deprecated use `GetHomeDataResponse$outboundSchema` instead. */ + export const outboundSchema = GetHomeDataResponse$outboundSchema; + /** @deprecated use `GetHomeDataResponse$Outbound` instead. */ + export type Outbound = GetHomeDataResponse$Outbound; } diff --git a/src/models/getlibrariesop.ts b/src/models/getlibrariesop.ts index 1fa661c9..1e94a576 100644 --- a/src/models/getlibrariesop.ts +++ b/src/models/getlibrariesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetLibrariesLibraryResponseBody extends Error { data$: GetLibrariesLibraryResponseBodyData; constructor(err: GetLibrariesLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,16 +50,11 @@ export class GetLibrariesLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetLibrariesLibraryResponseBody"; } } -export type GetLibrariesLocation = { +export type Location = { id?: number | undefined; path?: string | undefined; }; @@ -81,7 +80,7 @@ export type GetLibrariesDirectory = { directory?: boolean | undefined; contentChangedAt?: number | undefined; hidden?: number | undefined; - location?: Array | undefined; + location?: Array | undefined; }; export type GetLibrariesMediaContainer = { @@ -118,281 +117,414 @@ export type GetLibrariesResponse = { }; /** @internal */ +export const GetLibrariesErrors$inboundSchema: z.ZodType< + GetLibrariesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetLibrariesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetLibrariesErrors$outboundSchema: z.ZodType< + GetLibrariesErrors$Outbound, + z.ZodTypeDef, + GetLibrariesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibrariesErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetLibrariesErrors$inboundSchema` instead. */ + export const inboundSchema = GetLibrariesErrors$inboundSchema; + /** @deprecated use `GetLibrariesErrors$outboundSchema` instead. */ + export const outboundSchema = GetLibrariesErrors$outboundSchema; + /** @deprecated use `GetLibrariesErrors$Outbound` instead. */ + export type Outbound = GetLibrariesErrors$Outbound; } /** @internal */ -export namespace GetLibrariesLibraryResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetLibrariesLibraryResponseBody$inboundSchema: z.ZodType< + GetLibrariesLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetLibrariesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetLibrariesLibraryResponseBody(remapped); + }); + +/** @internal */ +export type GetLibrariesLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetLibrariesLibraryResponseBody$outboundSchema: z.ZodType< + GetLibrariesLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetLibrariesLibraryResponseBody +> = z + .instanceof(GetLibrariesLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => GetLibrariesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => GetLibrariesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new GetLibrariesLibraryResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetLibrariesLibraryResponseBody - > = z - .instanceof(GetLibrariesLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetLibrariesErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibrariesLibraryResponseBody$ { + /** @deprecated use `GetLibrariesLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibrariesLibraryResponseBody$inboundSchema; + /** @deprecated use `GetLibrariesLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibrariesLibraryResponseBody$outboundSchema; + /** @deprecated use `GetLibrariesLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetLibrariesLibraryResponseBody$Outbound; } /** @internal */ -export namespace GetLibrariesLocation$ { - export const inboundSchema: z.ZodType = z.object({ +export const Location$inboundSchema: z.ZodType = z.object({ + id: z.number().int().optional(), + path: z.string().optional(), +}); + +/** @internal */ +export type Location$Outbound = { + id?: number | undefined; + path?: string | undefined; +}; + +/** @internal */ +export const Location$outboundSchema: z.ZodType = + z.object({ id: z.number().int().optional(), path: z.string().optional(), }); - export type Outbound = { - id?: number | undefined; - path?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - id: z.number().int().optional(), - path: z.string().optional(), - } - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Location$ { + /** @deprecated use `Location$inboundSchema` instead. */ + export const inboundSchema = Location$inboundSchema; + /** @deprecated use `Location$outboundSchema` instead. */ + export const outboundSchema = Location$outboundSchema; + /** @deprecated use `Location$Outbound` instead. */ + export type Outbound = Location$Outbound; } /** @internal */ +export const GetLibrariesDirectory$inboundSchema: z.ZodType< + GetLibrariesDirectory, + z.ZodTypeDef, + unknown +> = z + .object({ + allowSync: z.boolean().optional(), + art: z.string().optional(), + composite: z.string().optional(), + filters: z.boolean().optional(), + refreshing: z.boolean().optional(), + thumb: z.string().optional(), + key: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + agent: z.string().optional(), + scanner: z.string().optional(), + language: z.string().optional(), + uuid: z.string().optional(), + updatedAt: z.number().int().optional(), + createdAt: z.number().int().optional(), + scannedAt: z.number().int().optional(), + content: z.boolean().optional(), + directory: z.boolean().optional(), + contentChangedAt: z.number().int().optional(), + hidden: z.number().int().optional(), + Location: z.array(z.lazy(() => Location$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Location: "location", + }); + }); + +/** @internal */ +export type GetLibrariesDirectory$Outbound = { + allowSync?: boolean | undefined; + art?: string | undefined; + composite?: string | undefined; + filters?: boolean | undefined; + refreshing?: boolean | undefined; + thumb?: string | undefined; + key?: string | undefined; + type?: string | undefined; + title?: string | undefined; + agent?: string | undefined; + scanner?: string | undefined; + language?: string | undefined; + uuid?: string | undefined; + updatedAt?: number | undefined; + createdAt?: number | undefined; + scannedAt?: number | undefined; + content?: boolean | undefined; + directory?: boolean | undefined; + contentChangedAt?: number | undefined; + hidden?: number | undefined; + Location?: Array | undefined; +}; + +/** @internal */ +export const GetLibrariesDirectory$outboundSchema: z.ZodType< + GetLibrariesDirectory$Outbound, + z.ZodTypeDef, + GetLibrariesDirectory +> = z + .object({ + allowSync: z.boolean().optional(), + art: z.string().optional(), + composite: z.string().optional(), + filters: z.boolean().optional(), + refreshing: z.boolean().optional(), + thumb: z.string().optional(), + key: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + agent: z.string().optional(), + scanner: z.string().optional(), + language: z.string().optional(), + uuid: z.string().optional(), + updatedAt: z.number().int().optional(), + createdAt: z.number().int().optional(), + scannedAt: z.number().int().optional(), + content: z.boolean().optional(), + directory: z.boolean().optional(), + contentChangedAt: z.number().int().optional(), + hidden: z.number().int().optional(), + location: z.array(z.lazy(() => Location$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + location: "Location", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibrariesDirectory$ { - export const inboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - art: z.string().optional(), - composite: z.string().optional(), - filters: z.boolean().optional(), - refreshing: z.boolean().optional(), - thumb: z.string().optional(), - key: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - agent: z.string().optional(), - scanner: z.string().optional(), - language: z.string().optional(), - uuid: z.string().optional(), - updatedAt: z.number().int().optional(), - createdAt: z.number().int().optional(), - scannedAt: z.number().int().optional(), - content: z.boolean().optional(), - directory: z.boolean().optional(), - contentChangedAt: z.number().int().optional(), - hidden: z.number().int().optional(), - Location: z.array(z.lazy(() => GetLibrariesLocation$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Location: "location", - }); - }); - - export type Outbound = { - allowSync?: boolean | undefined; - art?: string | undefined; - composite?: string | undefined; - filters?: boolean | undefined; - refreshing?: boolean | undefined; - thumb?: string | undefined; - key?: string | undefined; - type?: string | undefined; - title?: string | undefined; - agent?: string | undefined; - scanner?: string | undefined; - language?: string | undefined; - uuid?: string | undefined; - updatedAt?: number | undefined; - createdAt?: number | undefined; - scannedAt?: number | undefined; - content?: boolean | undefined; - directory?: boolean | undefined; - contentChangedAt?: number | undefined; - hidden?: number | undefined; - Location?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - art: z.string().optional(), - composite: z.string().optional(), - filters: z.boolean().optional(), - refreshing: z.boolean().optional(), - thumb: z.string().optional(), - key: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - agent: z.string().optional(), - scanner: z.string().optional(), - language: z.string().optional(), - uuid: z.string().optional(), - updatedAt: z.number().int().optional(), - createdAt: z.number().int().optional(), - scannedAt: z.number().int().optional(), - content: z.boolean().optional(), - directory: z.boolean().optional(), - contentChangedAt: z.number().int().optional(), - hidden: z.number().int().optional(), - location: z.array(z.lazy(() => GetLibrariesLocation$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - location: "Location", - }); - }); + /** @deprecated use `GetLibrariesDirectory$inboundSchema` instead. */ + export const inboundSchema = GetLibrariesDirectory$inboundSchema; + /** @deprecated use `GetLibrariesDirectory$outboundSchema` instead. */ + export const outboundSchema = GetLibrariesDirectory$outboundSchema; + /** @deprecated use `GetLibrariesDirectory$Outbound` instead. */ + export type Outbound = GetLibrariesDirectory$Outbound; } /** @internal */ +export const GetLibrariesMediaContainer$inboundSchema: z.ZodType< + GetLibrariesMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + title1: z.string().optional(), + Directory: z.array(z.lazy(() => GetLibrariesDirectory$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Directory: "directory", + }); + }); + +/** @internal */ +export type GetLibrariesMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + title1?: string | undefined; + Directory?: Array | undefined; +}; + +/** @internal */ +export const GetLibrariesMediaContainer$outboundSchema: z.ZodType< + GetLibrariesMediaContainer$Outbound, + z.ZodTypeDef, + GetLibrariesMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + title1: z.string().optional(), + directory: z.array(z.lazy(() => GetLibrariesDirectory$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + directory: "Directory", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibrariesMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - title1: z.string().optional(), - Directory: z.array(z.lazy(() => GetLibrariesDirectory$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Directory: "directory", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - title1?: string | undefined; - Directory?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - title1: z.string().optional(), - directory: z.array(z.lazy(() => GetLibrariesDirectory$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - directory: "Directory", - }); - }); + /** @deprecated use `GetLibrariesMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetLibrariesMediaContainer$inboundSchema; + /** @deprecated use `GetLibrariesMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetLibrariesMediaContainer$outboundSchema; + /** @deprecated use `GetLibrariesMediaContainer$Outbound` instead. */ + export type Outbound = GetLibrariesMediaContainer$Outbound; } /** @internal */ +export const GetLibrariesResponseBody$inboundSchema: z.ZodType< + GetLibrariesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetLibrariesMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetLibrariesResponseBody$Outbound = { + MediaContainer?: GetLibrariesMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetLibrariesResponseBody$outboundSchema: z.ZodType< + GetLibrariesResponseBody$Outbound, + z.ZodTypeDef, + GetLibrariesResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetLibrariesMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibrariesResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetLibrariesMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetLibrariesMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetLibrariesMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetLibrariesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibrariesResponseBody$inboundSchema; + /** @deprecated use `GetLibrariesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibrariesResponseBody$outboundSchema; + /** @deprecated use `GetLibrariesResponseBody$Outbound` instead. */ + export type Outbound = GetLibrariesResponseBody$Outbound; } /** @internal */ +export const GetLibrariesResponse$inboundSchema: z.ZodType< + GetLibrariesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetLibrariesResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetLibrariesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetLibrariesResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetLibrariesResponse$outboundSchema: z.ZodType< + GetLibrariesResponse$Outbound, + z.ZodTypeDef, + GetLibrariesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetLibrariesResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibrariesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetLibrariesResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetLibrariesResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetLibrariesResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetLibrariesResponse$inboundSchema` instead. */ + export const inboundSchema = GetLibrariesResponse$inboundSchema; + /** @deprecated use `GetLibrariesResponse$outboundSchema` instead. */ + export const outboundSchema = GetLibrariesResponse$outboundSchema; + /** @deprecated use `GetLibrariesResponse$Outbound` instead. */ + export type Outbound = GetLibrariesResponse$Outbound; } diff --git a/src/models/getlibraryhubsop.ts b/src/models/getlibraryhubsop.ts index 980d45f2..1ee07c4d 100644 --- a/src/models/getlibraryhubsop.ts +++ b/src/models/getlibraryhubsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -60,7 +60,11 @@ export class GetLibraryHubsHubsResponseBody extends Error { data$: GetLibraryHubsHubsResponseBodyData; constructor(err: GetLibraryHubsHubsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -70,11 +74,6 @@ export class GetLibraryHubsHubsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetLibraryHubsHubsResponseBody"; } } @@ -221,445 +220,678 @@ export type GetLibraryHubsResponse = { }; /** @internal */ +export const QueryParamOnlyTransient$inboundSchema: z.ZodNativeEnum< + typeof QueryParamOnlyTransient +> = z.nativeEnum(QueryParamOnlyTransient); + +/** @internal */ +export const QueryParamOnlyTransient$outboundSchema: z.ZodNativeEnum< + typeof QueryParamOnlyTransient +> = QueryParamOnlyTransient$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace QueryParamOnlyTransient$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(QueryParamOnlyTransient); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `QueryParamOnlyTransient$inboundSchema` instead. */ + export const inboundSchema = QueryParamOnlyTransient$inboundSchema; + /** @deprecated use `QueryParamOnlyTransient$outboundSchema` instead. */ + export const outboundSchema = QueryParamOnlyTransient$outboundSchema; } /** @internal */ +export const GetLibraryHubsRequest$inboundSchema: z.ZodType< + GetLibraryHubsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sectionId: z.number(), + count: z.number().optional(), + onlyTransient: QueryParamOnlyTransient$inboundSchema.optional(), +}); + +/** @internal */ +export type GetLibraryHubsRequest$Outbound = { + sectionId: number; + count?: number | undefined; + onlyTransient?: number | undefined; +}; + +/** @internal */ +export const GetLibraryHubsRequest$outboundSchema: z.ZodType< + GetLibraryHubsRequest$Outbound, + z.ZodTypeDef, + GetLibraryHubsRequest +> = z.object({ + sectionId: z.number(), + count: z.number().optional(), + onlyTransient: QueryParamOnlyTransient$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsRequest$ { - export const inboundSchema: z.ZodType = z.object({ - sectionId: z.number(), - count: z.number().optional(), - onlyTransient: QueryParamOnlyTransient$.inboundSchema.optional(), - }); - - export type Outbound = { - sectionId: number; - count?: number | undefined; - onlyTransient?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - sectionId: z.number(), - count: z.number().optional(), - onlyTransient: QueryParamOnlyTransient$.outboundSchema.optional(), - }); + /** @deprecated use `GetLibraryHubsRequest$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsRequest$inboundSchema; + /** @deprecated use `GetLibraryHubsRequest$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsRequest$outboundSchema; + /** @deprecated use `GetLibraryHubsRequest$Outbound` instead. */ + export type Outbound = GetLibraryHubsRequest$Outbound; } /** @internal */ +export const GetLibraryHubsErrors$inboundSchema: z.ZodType< + GetLibraryHubsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetLibraryHubsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetLibraryHubsErrors$outboundSchema: z.ZodType< + GetLibraryHubsErrors$Outbound, + z.ZodTypeDef, + GetLibraryHubsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } - ); + /** @deprecated use `GetLibraryHubsErrors$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsErrors$inboundSchema; + /** @deprecated use `GetLibraryHubsErrors$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsErrors$outboundSchema; + /** @deprecated use `GetLibraryHubsErrors$Outbound` instead. */ + export type Outbound = GetLibraryHubsErrors$Outbound; } /** @internal */ -export namespace GetLibraryHubsHubsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetLibraryHubsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetLibraryHubsHubsResponseBody(remapped); +export const GetLibraryHubsHubsResponseBody$inboundSchema: z.ZodType< + GetLibraryHubsHubsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetLibraryHubsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new GetLibraryHubsHubsResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type GetLibraryHubsHubsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetLibraryHubsHubsResponseBody$outboundSchema: z.ZodType< + GetLibraryHubsHubsResponseBody$Outbound, + z.ZodTypeDef, + GetLibraryHubsHubsResponseBody +> = z + .instanceof(GetLibraryHubsHubsResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(GetLibraryHubsHubsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetLibraryHubsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => GetLibraryHubsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryHubsHubsResponseBody$ { + /** @deprecated use `GetLibraryHubsHubsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsHubsResponseBody$inboundSchema; + /** @deprecated use `GetLibraryHubsHubsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsHubsResponseBody$outboundSchema; + /** @deprecated use `GetLibraryHubsHubsResponseBody$Outbound` instead. */ + export type Outbound = GetLibraryHubsHubsResponseBody$Outbound; } /** @internal */ +export const GetLibraryHubsPart$inboundSchema: z.ZodType< + GetLibraryHubsPart, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryHubsPart$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + audioProfile?: string | undefined; + container?: string | undefined; + has64bitOffsets?: boolean | undefined; + optimizedForStreaming?: boolean | undefined; + videoProfile?: string | undefined; +}; + +/** @internal */ +export const GetLibraryHubsPart$outboundSchema: z.ZodType< + GetLibraryHubsPart$Outbound, + z.ZodTypeDef, + GetLibraryHubsPart +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsPart$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - audioProfile?: string | undefined; - container?: string | undefined; - has64bitOffsets?: boolean | undefined; - optimizedForStreaming?: boolean | undefined; - videoProfile?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - }); + /** @deprecated use `GetLibraryHubsPart$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsPart$inboundSchema; + /** @deprecated use `GetLibraryHubsPart$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsPart$outboundSchema; + /** @deprecated use `GetLibraryHubsPart$Outbound` instead. */ + export type Outbound = GetLibraryHubsPart$Outbound; } /** @internal */ +export const GetLibraryHubsMedia$inboundSchema: z.ZodType< + GetLibraryHubsMedia, + z.ZodTypeDef, + unknown +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().int().optional(), + audioProfile: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => GetLibraryHubsPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetLibraryHubsMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: string | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + optimizedForStreaming?: number | undefined; + audioProfile?: string | undefined; + has64bitOffsets?: boolean | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetLibraryHubsMedia$outboundSchema: z.ZodType< + GetLibraryHubsMedia$Outbound, + z.ZodTypeDef, + GetLibraryHubsMedia +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().int().optional(), + audioProfile: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => GetLibraryHubsPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().int().optional(), - audioProfile: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => GetLibraryHubsPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: string | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - optimizedForStreaming?: number | undefined; - audioProfile?: string | undefined; - has64bitOffsets?: boolean | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().int().optional(), - audioProfile: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => GetLibraryHubsPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); + /** @deprecated use `GetLibraryHubsMedia$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsMedia$inboundSchema; + /** @deprecated use `GetLibraryHubsMedia$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsMedia$outboundSchema; + /** @deprecated use `GetLibraryHubsMedia$Outbound` instead. */ + export type Outbound = GetLibraryHubsMedia$Outbound; } /** @internal */ +export const GetLibraryHubsGenre$inboundSchema: z.ZodType< + GetLibraryHubsGenre, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryHubsGenre$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryHubsGenre$outboundSchema: z.ZodType< + GetLibraryHubsGenre$Outbound, + z.ZodTypeDef, + GetLibraryHubsGenre +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsGenre$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); + /** @deprecated use `GetLibraryHubsGenre$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsGenre$inboundSchema; + /** @deprecated use `GetLibraryHubsGenre$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsGenre$outboundSchema; + /** @deprecated use `GetLibraryHubsGenre$Outbound` instead. */ + export type Outbound = GetLibraryHubsGenre$Outbound; } /** @internal */ +export const GetLibraryHubsCountry$inboundSchema: z.ZodType< + GetLibraryHubsCountry, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryHubsCountry$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryHubsCountry$outboundSchema: z.ZodType< + GetLibraryHubsCountry$Outbound, + z.ZodTypeDef, + GetLibraryHubsCountry +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsCountry$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); + /** @deprecated use `GetLibraryHubsCountry$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsCountry$inboundSchema; + /** @deprecated use `GetLibraryHubsCountry$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsCountry$outboundSchema; + /** @deprecated use `GetLibraryHubsCountry$Outbound` instead. */ + export type Outbound = GetLibraryHubsCountry$Outbound; } /** @internal */ +export const GetLibraryHubsDirector$inboundSchema: z.ZodType< + GetLibraryHubsDirector, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryHubsDirector$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryHubsDirector$outboundSchema: z.ZodType< + GetLibraryHubsDirector$Outbound, + z.ZodTypeDef, + GetLibraryHubsDirector +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsDirector$ { - export const inboundSchema: z.ZodType = z.object( - { - tag: z.string().optional(), - } - ); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); + /** @deprecated use `GetLibraryHubsDirector$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsDirector$inboundSchema; + /** @deprecated use `GetLibraryHubsDirector$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsDirector$outboundSchema; + /** @deprecated use `GetLibraryHubsDirector$Outbound` instead. */ + export type Outbound = GetLibraryHubsDirector$Outbound; } /** @internal */ +export const GetLibraryHubsRole$inboundSchema: z.ZodType< + GetLibraryHubsRole, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryHubsRole$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryHubsRole$outboundSchema: z.ZodType< + GetLibraryHubsRole$Outbound, + z.ZodTypeDef, + GetLibraryHubsRole +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsRole$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); + /** @deprecated use `GetLibraryHubsRole$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsRole$inboundSchema; + /** @deprecated use `GetLibraryHubsRole$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsRole$outboundSchema; + /** @deprecated use `GetLibraryHubsRole$Outbound` instead. */ + export type Outbound = GetLibraryHubsRole$Outbound; } /** @internal */ +export const GetLibraryHubsWriter$inboundSchema: z.ZodType< + GetLibraryHubsWriter, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryHubsWriter$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryHubsWriter$outboundSchema: z.ZodType< + GetLibraryHubsWriter$Outbound, + z.ZodTypeDef, + GetLibraryHubsWriter +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsWriter$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), + /** @deprecated use `GetLibraryHubsWriter$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsWriter$inboundSchema; + /** @deprecated use `GetLibraryHubsWriter$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsWriter$outboundSchema; + /** @deprecated use `GetLibraryHubsWriter$Outbound` instead. */ + export type Outbound = GetLibraryHubsWriter$Outbound; +} + +/** @internal */ +export const GetLibraryHubsMetadata$inboundSchema: z.ZodType< + GetLibraryHubsMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + Media: z.array(z.lazy(() => GetLibraryHubsMedia$inboundSchema)).optional(), + Genre: z.array(z.lazy(() => GetLibraryHubsGenre$inboundSchema)).optional(), + Country: z.array(z.lazy(() => GetLibraryHubsCountry$inboundSchema)).optional(), + Director: z.array(z.lazy(() => GetLibraryHubsDirector$inboundSchema)).optional(), + Role: z.array(z.lazy(() => GetLibraryHubsRole$inboundSchema)).optional(), + Writer: z.array(z.lazy(() => GetLibraryHubsWriter$inboundSchema)).optional(), + skipCount: z.number().int().optional(), + chapterSource: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + Genre: "genre", + Country: "country", + Director: "director", + Role: "role", + Writer: "writer", + }); }); - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - tag: z.string().optional(), - } - ); -} +/** @internal */ +export type GetLibraryHubsMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + librarySectionTitle?: string | undefined; + librarySectionID?: number | undefined; + librarySectionKey?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + rating?: number | undefined; + audienceRating?: number | undefined; + viewCount?: number | undefined; + lastViewedAt?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + audienceRatingImage?: string | undefined; + primaryExtraKey?: string | undefined; + ratingImage?: string | undefined; + Media?: Array | undefined; + Genre?: Array | undefined; + Country?: Array | undefined; + Director?: Array | undefined; + Role?: Array | undefined; + Writer?: Array | undefined; + skipCount?: number | undefined; + chapterSource?: string | undefined; +}; /** @internal */ +export const GetLibraryHubsMetadata$outboundSchema: z.ZodType< + GetLibraryHubsMetadata$Outbound, + z.ZodTypeDef, + GetLibraryHubsMetadata +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + media: z.array(z.lazy(() => GetLibraryHubsMedia$outboundSchema)).optional(), + genre: z.array(z.lazy(() => GetLibraryHubsGenre$outboundSchema)).optional(), + country: z.array(z.lazy(() => GetLibraryHubsCountry$outboundSchema)).optional(), + director: z.array(z.lazy(() => GetLibraryHubsDirector$outboundSchema)).optional(), + role: z.array(z.lazy(() => GetLibraryHubsRole$outboundSchema)).optional(), + writer: z.array(z.lazy(() => GetLibraryHubsWriter$outboundSchema)).optional(), + skipCount: z.number().int().optional(), + chapterSource: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + genre: "Genre", + country: "Country", + director: "Director", + role: "Role", + writer: "Writer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - Media: z.array(z.lazy(() => GetLibraryHubsMedia$.inboundSchema)).optional(), - Genre: z.array(z.lazy(() => GetLibraryHubsGenre$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => GetLibraryHubsCountry$.inboundSchema)).optional(), - Director: z.array(z.lazy(() => GetLibraryHubsDirector$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => GetLibraryHubsRole$.inboundSchema)).optional(), - Writer: z.array(z.lazy(() => GetLibraryHubsWriter$.inboundSchema)).optional(), - skipCount: z.number().int().optional(), - chapterSource: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - Genre: "genre", - Country: "country", - Director: "director", - Role: "role", - Writer: "writer", - }); - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - librarySectionTitle?: string | undefined; - librarySectionID?: number | undefined; - librarySectionKey?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - rating?: number | undefined; - audienceRating?: number | undefined; - viewCount?: number | undefined; - lastViewedAt?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - audienceRatingImage?: string | undefined; - primaryExtraKey?: string | undefined; - ratingImage?: string | undefined; - Media?: Array | undefined; - Genre?: Array | undefined; - Country?: Array | undefined; - Director?: Array | undefined; - Role?: Array | undefined; - Writer?: Array | undefined; - skipCount?: number | undefined; - chapterSource?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - media: z.array(z.lazy(() => GetLibraryHubsMedia$.outboundSchema)).optional(), - genre: z.array(z.lazy(() => GetLibraryHubsGenre$.outboundSchema)).optional(), - country: z.array(z.lazy(() => GetLibraryHubsCountry$.outboundSchema)).optional(), - director: z.array(z.lazy(() => GetLibraryHubsDirector$.outboundSchema)).optional(), - role: z.array(z.lazy(() => GetLibraryHubsRole$.outboundSchema)).optional(), - writer: z.array(z.lazy(() => GetLibraryHubsWriter$.outboundSchema)).optional(), - skipCount: z.number().int().optional(), - chapterSource: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - genre: "Genre", - country: "Country", - director: "Director", - role: "Role", - writer: "Writer", - }); - }); + /** @deprecated use `GetLibraryHubsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsMetadata$inboundSchema; + /** @deprecated use `GetLibraryHubsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsMetadata$outboundSchema; + /** @deprecated use `GetLibraryHubsMetadata$Outbound` instead. */ + export type Outbound = GetLibraryHubsMetadata$Outbound; } /** @internal */ -export namespace GetLibraryHubsHub$ { - export const inboundSchema: z.ZodType = z +export const GetLibraryHubsHub$inboundSchema: z.ZodType = + z .object({ key: z.string().optional(), title: z.string().optional(), @@ -670,7 +902,7 @@ export namespace GetLibraryHubsHub$ { more: z.boolean().optional(), style: z.string().optional(), hubKey: z.string().optional(), - Metadata: z.array(z.lazy(() => GetLibraryHubsMetadata$.inboundSchema)).optional(), + Metadata: z.array(z.lazy(() => GetLibraryHubsMetadata$inboundSchema)).optional(), promoted: z.boolean().optional(), random: z.boolean().optional(), }) @@ -680,153 +912,234 @@ export namespace GetLibraryHubsHub$ { }); }); - export type Outbound = { - key?: string | undefined; - title?: string | undefined; - type?: string | undefined; - hubIdentifier?: string | undefined; - context?: string | undefined; - size?: number | undefined; - more?: boolean | undefined; - style?: string | undefined; - hubKey?: string | undefined; - Metadata?: Array | undefined; - promoted?: boolean | undefined; - random?: boolean | undefined; - }; +/** @internal */ +export type GetLibraryHubsHub$Outbound = { + key?: string | undefined; + title?: string | undefined; + type?: string | undefined; + hubIdentifier?: string | undefined; + context?: string | undefined; + size?: number | undefined; + more?: boolean | undefined; + style?: string | undefined; + hubKey?: string | undefined; + Metadata?: Array | undefined; + promoted?: boolean | undefined; + random?: boolean | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - hubIdentifier: z.string().optional(), - context: z.string().optional(), - size: z.number().int().optional(), - more: z.boolean().optional(), - style: z.string().optional(), - hubKey: z.string().optional(), - metadata: z.array(z.lazy(() => GetLibraryHubsMetadata$.outboundSchema)).optional(), - promoted: z.boolean().optional(), - random: z.boolean().optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); +/** @internal */ +export const GetLibraryHubsHub$outboundSchema: z.ZodType< + GetLibraryHubsHub$Outbound, + z.ZodTypeDef, + GetLibraryHubsHub +> = z + .object({ + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), + hubIdentifier: z.string().optional(), + context: z.string().optional(), + size: z.number().int().optional(), + more: z.boolean().optional(), + style: z.string().optional(), + hubKey: z.string().optional(), + metadata: z.array(z.lazy(() => GetLibraryHubsMetadata$outboundSchema)).optional(), + promoted: z.boolean().optional(), + random: z.boolean().optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryHubsHub$ { + /** @deprecated use `GetLibraryHubsHub$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsHub$inboundSchema; + /** @deprecated use `GetLibraryHubsHub$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsHub$outboundSchema; + /** @deprecated use `GetLibraryHubsHub$Outbound` instead. */ + export type Outbound = GetLibraryHubsHub$Outbound; } /** @internal */ +export const GetLibraryHubsMediaContainer$inboundSchema: z.ZodType< + GetLibraryHubsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + Hub: z.array(z.lazy(() => GetLibraryHubsHub$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Hub: "hub", + }); + }); + +/** @internal */ +export type GetLibraryHubsMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + identifier?: string | undefined; + librarySectionID?: number | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + Hub?: Array | undefined; +}; + +/** @internal */ +export const GetLibraryHubsMediaContainer$outboundSchema: z.ZodType< + GetLibraryHubsMediaContainer$Outbound, + z.ZodTypeDef, + GetLibraryHubsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + hub: z.array(z.lazy(() => GetLibraryHubsHub$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + hub: "Hub", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - Hub: z.array(z.lazy(() => GetLibraryHubsHub$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Hub: "hub", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - identifier?: string | undefined; - librarySectionID?: number | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - Hub?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - hub: z.array(z.lazy(() => GetLibraryHubsHub$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - hub: "Hub", - }); - }); + /** @deprecated use `GetLibraryHubsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsMediaContainer$inboundSchema; + /** @deprecated use `GetLibraryHubsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsMediaContainer$outboundSchema; + /** @deprecated use `GetLibraryHubsMediaContainer$Outbound` instead. */ + export type Outbound = GetLibraryHubsMediaContainer$Outbound; } /** @internal */ +export const GetLibraryHubsResponseBody$inboundSchema: z.ZodType< + GetLibraryHubsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetLibraryHubsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetLibraryHubsResponseBody$Outbound = { + MediaContainer?: GetLibraryHubsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetLibraryHubsResponseBody$outboundSchema: z.ZodType< + GetLibraryHubsResponseBody$Outbound, + z.ZodTypeDef, + GetLibraryHubsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetLibraryHubsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetLibraryHubsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetLibraryHubsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetLibraryHubsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetLibraryHubsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsResponseBody$inboundSchema; + /** @deprecated use `GetLibraryHubsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsResponseBody$outboundSchema; + /** @deprecated use `GetLibraryHubsResponseBody$Outbound` instead. */ + export type Outbound = GetLibraryHubsResponseBody$Outbound; } /** @internal */ +export const GetLibraryHubsResponse$inboundSchema: z.ZodType< + GetLibraryHubsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetLibraryHubsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetLibraryHubsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetLibraryHubsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetLibraryHubsResponse$outboundSchema: z.ZodType< + GetLibraryHubsResponse$Outbound, + z.ZodTypeDef, + GetLibraryHubsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetLibraryHubsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryHubsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetLibraryHubsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetLibraryHubsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetLibraryHubsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetLibraryHubsResponse$inboundSchema` instead. */ + export const inboundSchema = GetLibraryHubsResponse$inboundSchema; + /** @deprecated use `GetLibraryHubsResponse$outboundSchema` instead. */ + export const outboundSchema = GetLibraryHubsResponse$outboundSchema; + /** @deprecated use `GetLibraryHubsResponse$Outbound` instead. */ + export type Outbound = GetLibraryHubsResponse$Outbound; } diff --git a/src/models/getlibraryitemsop.ts b/src/models/getlibraryitemsop.ts index 2f21b4d1..ed5a9333 100644 --- a/src/models/getlibraryitemsop.ts +++ b/src/models/getlibraryitemsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -80,7 +80,11 @@ export class GetLibraryItemsLibraryResponseBody extends Error { data$: GetLibraryItemsLibraryResponseBodyData; constructor(err: GetLibraryItemsLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -90,11 +94,6 @@ export class GetLibraryItemsLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetLibraryItemsLibraryResponseBody"; } } @@ -254,652 +253,949 @@ export type GetLibraryItemsResponse = { }; /** @internal */ +export const Tag$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Tag); + +/** @internal */ +export const Tag$outboundSchema: z.ZodNativeEnum = Tag$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Tag$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Tag); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Tag$inboundSchema` instead. */ + export const inboundSchema = Tag$inboundSchema; + /** @deprecated use `Tag$outboundSchema` instead. */ + export const outboundSchema = Tag$outboundSchema; } /** @internal */ +export const GetLibraryItemsRequest$inboundSchema: z.ZodType< + GetLibraryItemsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sectionId: z.any().optional(), + tag: Tag$inboundSchema, + includeGuids: z.number().int().optional(), +}); + +/** @internal */ +export type GetLibraryItemsRequest$Outbound = { + sectionId?: any | undefined; + tag: string; + includeGuids?: number | undefined; +}; + +/** @internal */ +export const GetLibraryItemsRequest$outboundSchema: z.ZodType< + GetLibraryItemsRequest$Outbound, + z.ZodTypeDef, + GetLibraryItemsRequest +> = z.object({ + sectionId: z.any().optional(), + tag: Tag$outboundSchema, + includeGuids: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryItemsRequest$ { - export const inboundSchema: z.ZodType = z.object( - { - sectionId: z.any().optional(), - tag: Tag$.inboundSchema, - includeGuids: z.number().int().optional(), - } - ); - - export type Outbound = { - sectionId?: any | undefined; - tag: string; - includeGuids?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - sectionId: z.any().optional(), - tag: Tag$.outboundSchema, - includeGuids: z.number().int().optional(), - }); + /** @deprecated use `GetLibraryItemsRequest$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsRequest$inboundSchema; + /** @deprecated use `GetLibraryItemsRequest$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsRequest$outboundSchema; + /** @deprecated use `GetLibraryItemsRequest$Outbound` instead. */ + export type Outbound = GetLibraryItemsRequest$Outbound; } /** @internal */ +export const GetLibraryItemsErrors$inboundSchema: z.ZodType< + GetLibraryItemsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetLibraryItemsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetLibraryItemsErrors$outboundSchema: z.ZodType< + GetLibraryItemsErrors$Outbound, + z.ZodTypeDef, + GetLibraryItemsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryItemsErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `GetLibraryItemsErrors$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsErrors$inboundSchema; + /** @deprecated use `GetLibraryItemsErrors$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsErrors$outboundSchema; + /** @deprecated use `GetLibraryItemsErrors$Outbound` instead. */ + export type Outbound = GetLibraryItemsErrors$Outbound; +} + +/** @internal */ +export const GetLibraryItemsLibraryResponseBody$inboundSchema: z.ZodType< + GetLibraryItemsLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetLibraryItemsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetLibraryItemsLibraryResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} +/** @internal */ +export type GetLibraryItemsLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetLibraryItemsLibraryResponseBody$ { - export const inboundSchema: z.ZodType< - GetLibraryItemsLibraryResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetLibraryItemsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetLibraryItemsLibraryResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetLibraryItemsLibraryResponseBody - > = z - .instanceof(GetLibraryItemsLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetLibraryItemsErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace LibrarySectionID$ { - export const inboundSchema: z.ZodType = z.union([ - z.number().int(), - z.string(), - ]); - - export type Outbound = number | string; - export const outboundSchema: z.ZodType = z.union([ - z.number().int(), - z.string(), - ]); -} - -/** @internal */ -export namespace GetLibraryItemsPart$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - container: z.string().optional(), - videoProfile: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - container?: string | undefined; - videoProfile?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - container: z.string().optional(), - videoProfile: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetLibraryItemsMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => GetLibraryItemsPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: string | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => GetLibraryItemsPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); -} - -/** @internal */ -export namespace GetLibraryItemsGenre$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - tag: z.string().optional(), - } - ); -} - -/** @internal */ -export namespace GetLibraryItemsCountry$ { - export const inboundSchema: z.ZodType = z.object( - { - tag: z.string().optional(), - } - ); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetLibraryItemsDirector$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetLibraryItemsWriter$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetLibraryItemsRole$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetLibraryItemsMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - chapterSource: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - grandparentRatingKey: z.string().optional(), - grandparentGuid: z.string().optional(), - grandparentKey: z.string().optional(), - grandparentTitle: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentArt: z.string().optional(), - grandparentTheme: z.string().optional(), - Media: z.array(z.lazy(() => GetLibraryItemsMedia$.inboundSchema)).optional(), - Genre: z.array(z.lazy(() => GetLibraryItemsGenre$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => GetLibraryItemsCountry$.inboundSchema)).optional(), - Director: z.array(z.lazy(() => GetLibraryItemsDirector$.inboundSchema)).optional(), - Writer: z.array(z.lazy(() => GetLibraryItemsWriter$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => GetLibraryItemsRole$.inboundSchema)).optional(), - titleSort: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - originalTitle: z.string().optional(), - viewOffset: z.number().int().optional(), - skipCount: z.number().int().optional(), - index: z.number().int().optional(), - theme: z.string().optional(), - leafCount: z.number().int().optional(), - viewedLeafCount: z.number().int().optional(), - childCount: z.number().int().optional(), - hasPremiumExtras: z.string().optional(), - hasPremiumPrimaryExtra: z.string().optional(), - parentRatingKey: z.string().optional(), - parentGuid: z.string().optional(), - parentStudio: z.string().optional(), - parentKey: z.string().optional(), - parentTitle: z.string().optional(), - parentIndex: z.number().int().optional(), - parentYear: z.number().int().optional(), - parentThumb: z.string().optional(), - parentTheme: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - Genre: "genre", - Country: "country", - Director: "director", - Writer: "writer", - Role: "role", - }); - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - rating?: number | undefined; - audienceRating?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - audienceRatingImage?: string | undefined; - chapterSource?: string | undefined; - primaryExtraKey?: string | undefined; - ratingImage?: string | undefined; - grandparentRatingKey?: string | undefined; - grandparentGuid?: string | undefined; - grandparentKey?: string | undefined; - grandparentTitle?: string | undefined; - grandparentThumb?: string | undefined; - grandparentArt?: string | undefined; - grandparentTheme?: string | undefined; - Media?: Array | undefined; - Genre?: Array | undefined; - Country?: Array | undefined; - Director?: Array | undefined; - Writer?: Array | undefined; - Role?: Array | undefined; - titleSort?: string | undefined; - viewCount?: number | undefined; - lastViewedAt?: number | undefined; - originalTitle?: string | undefined; - viewOffset?: number | undefined; - skipCount?: number | undefined; - index?: number | undefined; - theme?: string | undefined; - leafCount?: number | undefined; - viewedLeafCount?: number | undefined; - childCount?: number | undefined; - hasPremiumExtras?: string | undefined; - hasPremiumPrimaryExtra?: string | undefined; - parentRatingKey?: string | undefined; - parentGuid?: string | undefined; - parentStudio?: string | undefined; - parentKey?: string | undefined; - parentTitle?: string | undefined; - parentIndex?: number | undefined; - parentYear?: number | undefined; - parentThumb?: string | undefined; - parentTheme?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - chapterSource: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - grandparentRatingKey: z.string().optional(), - grandparentGuid: z.string().optional(), - grandparentKey: z.string().optional(), - grandparentTitle: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentArt: z.string().optional(), - grandparentTheme: z.string().optional(), - media: z.array(z.lazy(() => GetLibraryItemsMedia$.outboundSchema)).optional(), - genre: z.array(z.lazy(() => GetLibraryItemsGenre$.outboundSchema)).optional(), - country: z.array(z.lazy(() => GetLibraryItemsCountry$.outboundSchema)).optional(), - director: z.array(z.lazy(() => GetLibraryItemsDirector$.outboundSchema)).optional(), - writer: z.array(z.lazy(() => GetLibraryItemsWriter$.outboundSchema)).optional(), - role: z.array(z.lazy(() => GetLibraryItemsRole$.outboundSchema)).optional(), - titleSort: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - originalTitle: z.string().optional(), - viewOffset: z.number().int().optional(), - skipCount: z.number().int().optional(), - index: z.number().int().optional(), - theme: z.string().optional(), - leafCount: z.number().int().optional(), - viewedLeafCount: z.number().int().optional(), - childCount: z.number().int().optional(), - hasPremiumExtras: z.string().optional(), - hasPremiumPrimaryExtra: z.string().optional(), - parentRatingKey: z.string().optional(), - parentGuid: z.string().optional(), - parentStudio: z.string().optional(), - parentKey: z.string().optional(), - parentTitle: z.string().optional(), - parentIndex: z.number().int().optional(), - parentYear: z.number().int().optional(), - parentThumb: z.string().optional(), - parentTheme: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - genre: "Genre", - country: "Country", - director: "Director", - writer: "Writer", - role: "Role", - }); - }); -} - -/** @internal */ -export namespace GetLibraryItemsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - identifier: z.string().optional(), - librarySectionID: z.union([z.number().int(), z.string()]).optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - title2: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - mixedParents: z.boolean().optional(), - Metadata: z.array(z.lazy(() => GetLibraryItemsMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - art?: string | undefined; - identifier?: string | undefined; - librarySectionID?: number | string | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - thumb?: string | undefined; - title1?: string | undefined; - title2?: string | undefined; - viewGroup?: string | undefined; - viewMode?: number | undefined; - mixedParents?: boolean | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetLibraryItemsLibraryResponseBody$outboundSchema: z.ZodType< + GetLibraryItemsLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetLibraryItemsLibraryResponseBody +> = z + .instanceof(GetLibraryItemsLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - identifier: z.string().optional(), - librarySectionID: z.union([z.number().int(), z.string()]).optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - title2: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - mixedParents: z.boolean().optional(), - metadata: z.array(z.lazy(() => GetLibraryItemsMetadata$.outboundSchema)).optional(), + errors: z.array(z.lazy(() => GetLibraryItemsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - metadata: "Metadata", + rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsLibraryResponseBody$ { + /** @deprecated use `GetLibraryItemsLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsLibraryResponseBody$inboundSchema; + /** @deprecated use `GetLibraryItemsLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsLibraryResponseBody$outboundSchema; + /** @deprecated use `GetLibraryItemsLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetLibraryItemsLibraryResponseBody$Outbound; } /** @internal */ +export const LibrarySectionID$inboundSchema: z.ZodType = + z.union([z.number().int(), z.string()]); + +/** @internal */ +export type LibrarySectionID$Outbound = number | string; + +/** @internal */ +export const LibrarySectionID$outboundSchema: z.ZodType< + LibrarySectionID$Outbound, + z.ZodTypeDef, + LibrarySectionID +> = z.union([z.number().int(), z.string()]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace LibrarySectionID$ { + /** @deprecated use `LibrarySectionID$inboundSchema` instead. */ + export const inboundSchema = LibrarySectionID$inboundSchema; + /** @deprecated use `LibrarySectionID$outboundSchema` instead. */ + export const outboundSchema = LibrarySectionID$outboundSchema; + /** @deprecated use `LibrarySectionID$Outbound` instead. */ + export type Outbound = LibrarySectionID$Outbound; +} + +/** @internal */ +export const GetLibraryItemsPart$inboundSchema: z.ZodType< + GetLibraryItemsPart, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + container: z.string().optional(), + videoProfile: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryItemsPart$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + container?: string | undefined; + videoProfile?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsPart$outboundSchema: z.ZodType< + GetLibraryItemsPart$Outbound, + z.ZodTypeDef, + GetLibraryItemsPart +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + container: z.string().optional(), + videoProfile: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsPart$ { + /** @deprecated use `GetLibraryItemsPart$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsPart$inboundSchema; + /** @deprecated use `GetLibraryItemsPart$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsPart$outboundSchema; + /** @deprecated use `GetLibraryItemsPart$Outbound` instead. */ + export type Outbound = GetLibraryItemsPart$Outbound; +} + +/** @internal */ +export const GetLibraryItemsMedia$inboundSchema: z.ZodType< + GetLibraryItemsMedia, + z.ZodTypeDef, + unknown +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => GetLibraryItemsPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetLibraryItemsMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: string | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetLibraryItemsMedia$outboundSchema: z.ZodType< + GetLibraryItemsMedia$Outbound, + z.ZodTypeDef, + GetLibraryItemsMedia +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => GetLibraryItemsPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsMedia$ { + /** @deprecated use `GetLibraryItemsMedia$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsMedia$inboundSchema; + /** @deprecated use `GetLibraryItemsMedia$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsMedia$outboundSchema; + /** @deprecated use `GetLibraryItemsMedia$Outbound` instead. */ + export type Outbound = GetLibraryItemsMedia$Outbound; +} + +/** @internal */ +export const GetLibraryItemsGenre$inboundSchema: z.ZodType< + GetLibraryItemsGenre, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryItemsGenre$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsGenre$outboundSchema: z.ZodType< + GetLibraryItemsGenre$Outbound, + z.ZodTypeDef, + GetLibraryItemsGenre +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsGenre$ { + /** @deprecated use `GetLibraryItemsGenre$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsGenre$inboundSchema; + /** @deprecated use `GetLibraryItemsGenre$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsGenre$outboundSchema; + /** @deprecated use `GetLibraryItemsGenre$Outbound` instead. */ + export type Outbound = GetLibraryItemsGenre$Outbound; +} + +/** @internal */ +export const GetLibraryItemsCountry$inboundSchema: z.ZodType< + GetLibraryItemsCountry, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryItemsCountry$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsCountry$outboundSchema: z.ZodType< + GetLibraryItemsCountry$Outbound, + z.ZodTypeDef, + GetLibraryItemsCountry +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsCountry$ { + /** @deprecated use `GetLibraryItemsCountry$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsCountry$inboundSchema; + /** @deprecated use `GetLibraryItemsCountry$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsCountry$outboundSchema; + /** @deprecated use `GetLibraryItemsCountry$Outbound` instead. */ + export type Outbound = GetLibraryItemsCountry$Outbound; +} + +/** @internal */ +export const GetLibraryItemsDirector$inboundSchema: z.ZodType< + GetLibraryItemsDirector, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryItemsDirector$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsDirector$outboundSchema: z.ZodType< + GetLibraryItemsDirector$Outbound, + z.ZodTypeDef, + GetLibraryItemsDirector +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsDirector$ { + /** @deprecated use `GetLibraryItemsDirector$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsDirector$inboundSchema; + /** @deprecated use `GetLibraryItemsDirector$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsDirector$outboundSchema; + /** @deprecated use `GetLibraryItemsDirector$Outbound` instead. */ + export type Outbound = GetLibraryItemsDirector$Outbound; +} + +/** @internal */ +export const GetLibraryItemsWriter$inboundSchema: z.ZodType< + GetLibraryItemsWriter, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryItemsWriter$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsWriter$outboundSchema: z.ZodType< + GetLibraryItemsWriter$Outbound, + z.ZodTypeDef, + GetLibraryItemsWriter +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsWriter$ { + /** @deprecated use `GetLibraryItemsWriter$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsWriter$inboundSchema; + /** @deprecated use `GetLibraryItemsWriter$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsWriter$outboundSchema; + /** @deprecated use `GetLibraryItemsWriter$Outbound` instead. */ + export type Outbound = GetLibraryItemsWriter$Outbound; +} + +/** @internal */ +export const GetLibraryItemsRole$inboundSchema: z.ZodType< + GetLibraryItemsRole, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetLibraryItemsRole$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsRole$outboundSchema: z.ZodType< + GetLibraryItemsRole$Outbound, + z.ZodTypeDef, + GetLibraryItemsRole +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsRole$ { + /** @deprecated use `GetLibraryItemsRole$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsRole$inboundSchema; + /** @deprecated use `GetLibraryItemsRole$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsRole$outboundSchema; + /** @deprecated use `GetLibraryItemsRole$Outbound` instead. */ + export type Outbound = GetLibraryItemsRole$Outbound; +} + +/** @internal */ +export const GetLibraryItemsMetadata$inboundSchema: z.ZodType< + GetLibraryItemsMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + chapterSource: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + grandparentRatingKey: z.string().optional(), + grandparentGuid: z.string().optional(), + grandparentKey: z.string().optional(), + grandparentTitle: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentArt: z.string().optional(), + grandparentTheme: z.string().optional(), + Media: z.array(z.lazy(() => GetLibraryItemsMedia$inboundSchema)).optional(), + Genre: z.array(z.lazy(() => GetLibraryItemsGenre$inboundSchema)).optional(), + Country: z.array(z.lazy(() => GetLibraryItemsCountry$inboundSchema)).optional(), + Director: z.array(z.lazy(() => GetLibraryItemsDirector$inboundSchema)).optional(), + Writer: z.array(z.lazy(() => GetLibraryItemsWriter$inboundSchema)).optional(), + Role: z.array(z.lazy(() => GetLibraryItemsRole$inboundSchema)).optional(), + titleSort: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + originalTitle: z.string().optional(), + viewOffset: z.number().int().optional(), + skipCount: z.number().int().optional(), + index: z.number().int().optional(), + theme: z.string().optional(), + leafCount: z.number().int().optional(), + viewedLeafCount: z.number().int().optional(), + childCount: z.number().int().optional(), + hasPremiumExtras: z.string().optional(), + hasPremiumPrimaryExtra: z.string().optional(), + parentRatingKey: z.string().optional(), + parentGuid: z.string().optional(), + parentStudio: z.string().optional(), + parentKey: z.string().optional(), + parentTitle: z.string().optional(), + parentIndex: z.number().int().optional(), + parentYear: z.number().int().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + Genre: "genre", + Country: "country", + Director: "director", + Writer: "writer", + Role: "role", + }); + }); + +/** @internal */ +export type GetLibraryItemsMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + rating?: number | undefined; + audienceRating?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + audienceRatingImage?: string | undefined; + chapterSource?: string | undefined; + primaryExtraKey?: string | undefined; + ratingImage?: string | undefined; + grandparentRatingKey?: string | undefined; + grandparentGuid?: string | undefined; + grandparentKey?: string | undefined; + grandparentTitle?: string | undefined; + grandparentThumb?: string | undefined; + grandparentArt?: string | undefined; + grandparentTheme?: string | undefined; + Media?: Array | undefined; + Genre?: Array | undefined; + Country?: Array | undefined; + Director?: Array | undefined; + Writer?: Array | undefined; + Role?: Array | undefined; + titleSort?: string | undefined; + viewCount?: number | undefined; + lastViewedAt?: number | undefined; + originalTitle?: string | undefined; + viewOffset?: number | undefined; + skipCount?: number | undefined; + index?: number | undefined; + theme?: string | undefined; + leafCount?: number | undefined; + viewedLeafCount?: number | undefined; + childCount?: number | undefined; + hasPremiumExtras?: string | undefined; + hasPremiumPrimaryExtra?: string | undefined; + parentRatingKey?: string | undefined; + parentGuid?: string | undefined; + parentStudio?: string | undefined; + parentKey?: string | undefined; + parentTitle?: string | undefined; + parentIndex?: number | undefined; + parentYear?: number | undefined; + parentThumb?: string | undefined; + parentTheme?: string | undefined; +}; + +/** @internal */ +export const GetLibraryItemsMetadata$outboundSchema: z.ZodType< + GetLibraryItemsMetadata$Outbound, + z.ZodTypeDef, + GetLibraryItemsMetadata +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + chapterSource: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + grandparentRatingKey: z.string().optional(), + grandparentGuid: z.string().optional(), + grandparentKey: z.string().optional(), + grandparentTitle: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentArt: z.string().optional(), + grandparentTheme: z.string().optional(), + media: z.array(z.lazy(() => GetLibraryItemsMedia$outboundSchema)).optional(), + genre: z.array(z.lazy(() => GetLibraryItemsGenre$outboundSchema)).optional(), + country: z.array(z.lazy(() => GetLibraryItemsCountry$outboundSchema)).optional(), + director: z.array(z.lazy(() => GetLibraryItemsDirector$outboundSchema)).optional(), + writer: z.array(z.lazy(() => GetLibraryItemsWriter$outboundSchema)).optional(), + role: z.array(z.lazy(() => GetLibraryItemsRole$outboundSchema)).optional(), + titleSort: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + originalTitle: z.string().optional(), + viewOffset: z.number().int().optional(), + skipCount: z.number().int().optional(), + index: z.number().int().optional(), + theme: z.string().optional(), + leafCount: z.number().int().optional(), + viewedLeafCount: z.number().int().optional(), + childCount: z.number().int().optional(), + hasPremiumExtras: z.string().optional(), + hasPremiumPrimaryExtra: z.string().optional(), + parentRatingKey: z.string().optional(), + parentGuid: z.string().optional(), + parentStudio: z.string().optional(), + parentKey: z.string().optional(), + parentTitle: z.string().optional(), + parentIndex: z.number().int().optional(), + parentYear: z.number().int().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + genre: "Genre", + country: "Country", + director: "Director", + writer: "Writer", + role: "Role", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsMetadata$ { + /** @deprecated use `GetLibraryItemsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsMetadata$inboundSchema; + /** @deprecated use `GetLibraryItemsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsMetadata$outboundSchema; + /** @deprecated use `GetLibraryItemsMetadata$Outbound` instead. */ + export type Outbound = GetLibraryItemsMetadata$Outbound; +} + +/** @internal */ +export const GetLibraryItemsMediaContainer$inboundSchema: z.ZodType< + GetLibraryItemsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + identifier: z.string().optional(), + librarySectionID: z.union([z.number().int(), z.string()]).optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + title2: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + mixedParents: z.boolean().optional(), + Metadata: z.array(z.lazy(() => GetLibraryItemsMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetLibraryItemsMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + art?: string | undefined; + identifier?: string | undefined; + librarySectionID?: number | string | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + thumb?: string | undefined; + title1?: string | undefined; + title2?: string | undefined; + viewGroup?: string | undefined; + viewMode?: number | undefined; + mixedParents?: boolean | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetLibraryItemsMediaContainer$outboundSchema: z.ZodType< + GetLibraryItemsMediaContainer$Outbound, + z.ZodTypeDef, + GetLibraryItemsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + identifier: z.string().optional(), + librarySectionID: z.union([z.number().int(), z.string()]).optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + title2: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + mixedParents: z.boolean().optional(), + metadata: z.array(z.lazy(() => GetLibraryItemsMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryItemsMediaContainer$ { + /** @deprecated use `GetLibraryItemsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsMediaContainer$inboundSchema; + /** @deprecated use `GetLibraryItemsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsMediaContainer$outboundSchema; + /** @deprecated use `GetLibraryItemsMediaContainer$Outbound` instead. */ + export type Outbound = GetLibraryItemsMediaContainer$Outbound; +} + +/** @internal */ +export const GetLibraryItemsResponseBody$inboundSchema: z.ZodType< + GetLibraryItemsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetLibraryItemsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetLibraryItemsResponseBody$Outbound = { + MediaContainer?: GetLibraryItemsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetLibraryItemsResponseBody$outboundSchema: z.ZodType< + GetLibraryItemsResponseBody$Outbound, + z.ZodTypeDef, + GetLibraryItemsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetLibraryItemsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryItemsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetLibraryItemsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetLibraryItemsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetLibraryItemsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetLibraryItemsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsResponseBody$inboundSchema; + /** @deprecated use `GetLibraryItemsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsResponseBody$outboundSchema; + /** @deprecated use `GetLibraryItemsResponseBody$Outbound` instead. */ + export type Outbound = GetLibraryItemsResponseBody$Outbound; } /** @internal */ +export const GetLibraryItemsResponse$inboundSchema: z.ZodType< + GetLibraryItemsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetLibraryItemsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetLibraryItemsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetLibraryItemsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetLibraryItemsResponse$outboundSchema: z.ZodType< + GetLibraryItemsResponse$Outbound, + z.ZodTypeDef, + GetLibraryItemsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetLibraryItemsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryItemsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetLibraryItemsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetLibraryItemsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetLibraryItemsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetLibraryItemsResponse$inboundSchema` instead. */ + export const inboundSchema = GetLibraryItemsResponse$inboundSchema; + /** @deprecated use `GetLibraryItemsResponse$outboundSchema` instead. */ + export const outboundSchema = GetLibraryItemsResponse$outboundSchema; + /** @deprecated use `GetLibraryItemsResponse$Outbound` instead. */ + export type Outbound = GetLibraryItemsResponse$Outbound; } diff --git a/src/models/getlibraryop.ts b/src/models/getlibraryop.ts index 3ca04d2d..cfbfdba2 100644 --- a/src/models/getlibraryop.ts +++ b/src/models/getlibraryop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -63,7 +63,11 @@ export class GetLibraryLibraryResponseBody extends Error { data$: GetLibraryLibraryResponseBodyData; constructor(err: GetLibraryLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -73,11 +77,6 @@ export class GetLibraryLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetLibraryLibraryResponseBody"; } } @@ -179,437 +178,677 @@ export type GetLibraryResponse = { }; /** @internal */ +export const IncludeDetails$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(IncludeDetails); + +/** @internal */ +export const IncludeDetails$outboundSchema: z.ZodNativeEnum = + IncludeDetails$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace IncludeDetails$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(IncludeDetails); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `IncludeDetails$inboundSchema` instead. */ + export const inboundSchema = IncludeDetails$inboundSchema; + /** @deprecated use `IncludeDetails$outboundSchema` instead. */ + export const outboundSchema = IncludeDetails$outboundSchema; } /** @internal */ +export const GetLibraryRequest$inboundSchema: z.ZodType = + z.object({ + sectionId: z.number(), + includeDetails: IncludeDetails$inboundSchema, + }); + +/** @internal */ +export type GetLibraryRequest$Outbound = { + sectionId: number; + includeDetails: number; +}; + +/** @internal */ +export const GetLibraryRequest$outboundSchema: z.ZodType< + GetLibraryRequest$Outbound, + z.ZodTypeDef, + GetLibraryRequest +> = z.object({ + sectionId: z.number(), + includeDetails: IncludeDetails$outboundSchema.default(IncludeDetails.Zero), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryRequest$ { - export const inboundSchema: z.ZodType = z.object({ - sectionId: z.number(), - includeDetails: IncludeDetails$.inboundSchema.default(IncludeDetails.Zero), - }); - - export type Outbound = { - sectionId: number; - includeDetails: number; - }; - - export const outboundSchema: z.ZodType = z.object({ - sectionId: z.number(), - includeDetails: IncludeDetails$.outboundSchema.default(IncludeDetails.Zero), - }); + /** @deprecated use `GetLibraryRequest$inboundSchema` instead. */ + export const inboundSchema = GetLibraryRequest$inboundSchema; + /** @deprecated use `GetLibraryRequest$outboundSchema` instead. */ + export const outboundSchema = GetLibraryRequest$outboundSchema; + /** @deprecated use `GetLibraryRequest$Outbound` instead. */ + export type Outbound = GetLibraryRequest$Outbound; } /** @internal */ +export const GetLibraryErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetLibraryErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetLibraryErrors$outboundSchema: z.ZodType< + GetLibraryErrors$Outbound, + z.ZodTypeDef, + GetLibraryErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetLibraryErrors$inboundSchema` instead. */ + export const inboundSchema = GetLibraryErrors$inboundSchema; + /** @deprecated use `GetLibraryErrors$outboundSchema` instead. */ + export const outboundSchema = GetLibraryErrors$outboundSchema; + /** @deprecated use `GetLibraryErrors$Outbound` instead. */ + export type Outbound = GetLibraryErrors$Outbound; } /** @internal */ -export namespace GetLibraryLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetLibraryErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetLibraryLibraryResponseBody(remapped); +export const GetLibraryLibraryResponseBody$inboundSchema: z.ZodType< + GetLibraryLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetLibraryErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new GetLibraryLibraryResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type GetLibraryLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetLibraryLibraryResponseBody$outboundSchema: z.ZodType< + GetLibraryLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetLibraryLibraryResponseBody +> = z + .instanceof(GetLibraryLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(GetLibraryLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetLibraryErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => GetLibraryErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetLibraryLibraryResponseBody$ { + /** @deprecated use `GetLibraryLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibraryLibraryResponseBody$inboundSchema; + /** @deprecated use `GetLibraryLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibraryLibraryResponseBody$outboundSchema; + /** @deprecated use `GetLibraryLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetLibraryLibraryResponseBody$Outbound; } /** @internal */ +export const GetLibraryDirectory$inboundSchema: z.ZodType< + GetLibraryDirectory, + z.ZodTypeDef, + unknown +> = z.object({ + key: z.string().optional(), + title: z.string().optional(), + secondary: z.boolean().optional(), + prompt: z.string().optional(), + search: z.boolean().optional(), +}); + +/** @internal */ +export type GetLibraryDirectory$Outbound = { + key?: string | undefined; + title?: string | undefined; + secondary?: boolean | undefined; + prompt?: string | undefined; + search?: boolean | undefined; +}; + +/** @internal */ +export const GetLibraryDirectory$outboundSchema: z.ZodType< + GetLibraryDirectory$Outbound, + z.ZodTypeDef, + GetLibraryDirectory +> = z.object({ + key: z.string().optional(), + title: z.string().optional(), + secondary: z.boolean().optional(), + prompt: z.string().optional(), + search: z.boolean().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryDirectory$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - secondary: z.boolean().optional(), - prompt: z.string().optional(), - search: z.boolean().optional(), - }); - - export type Outbound = { - key?: string | undefined; - title?: string | undefined; - secondary?: boolean | undefined; - prompt?: string | undefined; - search?: boolean | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - secondary: z.boolean().optional(), - prompt: z.string().optional(), - search: z.boolean().optional(), - }); + /** @deprecated use `GetLibraryDirectory$inboundSchema` instead. */ + export const inboundSchema = GetLibraryDirectory$inboundSchema; + /** @deprecated use `GetLibraryDirectory$outboundSchema` instead. */ + export const outboundSchema = GetLibraryDirectory$outboundSchema; + /** @deprecated use `GetLibraryDirectory$Outbound` instead. */ + export type Outbound = GetLibraryDirectory$Outbound; } /** @internal */ +export const GetLibraryFilter$inboundSchema: z.ZodType = + z.object({ + filter: z.string().optional(), + filterType: z.string().optional(), + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), + }); + +/** @internal */ +export type GetLibraryFilter$Outbound = { + filter?: string | undefined; + filterType?: string | undefined; + key?: string | undefined; + title?: string | undefined; + type?: string | undefined; +}; + +/** @internal */ +export const GetLibraryFilter$outboundSchema: z.ZodType< + GetLibraryFilter$Outbound, + z.ZodTypeDef, + GetLibraryFilter +> = z.object({ + filter: z.string().optional(), + filterType: z.string().optional(), + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryFilter$ { - export const inboundSchema: z.ZodType = z.object({ - filter: z.string().optional(), - filterType: z.string().optional(), - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - }); - - export type Outbound = { - filter?: string | undefined; - filterType?: string | undefined; - key?: string | undefined; - title?: string | undefined; - type?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - filter: z.string().optional(), - filterType: z.string().optional(), - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - }); + /** @deprecated use `GetLibraryFilter$inboundSchema` instead. */ + export const inboundSchema = GetLibraryFilter$inboundSchema; + /** @deprecated use `GetLibraryFilter$outboundSchema` instead. */ + export const outboundSchema = GetLibraryFilter$outboundSchema; + /** @deprecated use `GetLibraryFilter$Outbound` instead. */ + export type Outbound = GetLibraryFilter$Outbound; } /** @internal */ +export const Sort$inboundSchema: z.ZodType = z.object({ + default: z.string().optional(), + defaultDirection: z.string().optional(), + descKey: z.string().optional(), + firstCharacterKey: z.string().optional(), + key: z.string().optional(), + title: z.string().optional(), +}); + +/** @internal */ +export type Sort$Outbound = { + default?: string | undefined; + defaultDirection?: string | undefined; + descKey?: string | undefined; + firstCharacterKey?: string | undefined; + key?: string | undefined; + title?: string | undefined; +}; + +/** @internal */ +export const Sort$outboundSchema: z.ZodType = z.object({ + default: z.string().optional(), + defaultDirection: z.string().optional(), + descKey: z.string().optional(), + firstCharacterKey: z.string().optional(), + key: z.string().optional(), + title: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Sort$ { - export const inboundSchema: z.ZodType = z.object({ - default: z.string().optional(), - defaultDirection: z.string().optional(), - descKey: z.string().optional(), - firstCharacterKey: z.string().optional(), - key: z.string().optional(), - title: z.string().optional(), - }); - - export type Outbound = { - default?: string | undefined; - defaultDirection?: string | undefined; - descKey?: string | undefined; - firstCharacterKey?: string | undefined; - key?: string | undefined; - title?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - default: z.string().optional(), - defaultDirection: z.string().optional(), - descKey: z.string().optional(), - firstCharacterKey: z.string().optional(), - key: z.string().optional(), - title: z.string().optional(), - }); + /** @deprecated use `Sort$inboundSchema` instead. */ + export const inboundSchema = Sort$inboundSchema; + /** @deprecated use `Sort$outboundSchema` instead. */ + export const outboundSchema = Sort$outboundSchema; + /** @deprecated use `Sort$Outbound` instead. */ + export type Outbound = Sort$Outbound; } /** @internal */ +export const Field$inboundSchema: z.ZodType = z.object({ + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), + subType: z.string().optional(), +}); + +/** @internal */ +export type Field$Outbound = { + key?: string | undefined; + title?: string | undefined; + type?: string | undefined; + subType?: string | undefined; +}; + +/** @internal */ +export const Field$outboundSchema: z.ZodType = z.object({ + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), + subType: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Field$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - subType: z.string().optional(), - }); - - export type Outbound = { - key?: string | undefined; - title?: string | undefined; - type?: string | undefined; - subType?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - subType: z.string().optional(), - }); + /** @deprecated use `Field$inboundSchema` instead. */ + export const inboundSchema = Field$inboundSchema; + /** @deprecated use `Field$outboundSchema` instead. */ + export const outboundSchema = Field$outboundSchema; + /** @deprecated use `Field$Outbound` instead. */ + export type Outbound = Field$Outbound; } /** @internal */ +export const GetLibraryType$inboundSchema: z.ZodType = z + .object({ + key: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + active: z.boolean().optional(), + Filter: z.array(z.lazy(() => GetLibraryFilter$inboundSchema)).optional(), + Sort: z.array(z.lazy(() => Sort$inboundSchema)).optional(), + Field: z.array(z.lazy(() => Field$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Filter: "filter", + Sort: "sort", + Field: "field", + }); + }); + +/** @internal */ +export type GetLibraryType$Outbound = { + key?: string | undefined; + type?: string | undefined; + title?: string | undefined; + active?: boolean | undefined; + Filter?: Array | undefined; + Sort?: Array | undefined; + Field?: Array | undefined; +}; + +/** @internal */ +export const GetLibraryType$outboundSchema: z.ZodType< + GetLibraryType$Outbound, + z.ZodTypeDef, + GetLibraryType +> = z + .object({ + key: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + active: z.boolean().optional(), + filter: z.array(z.lazy(() => GetLibraryFilter$outboundSchema)).optional(), + sort: z.array(z.lazy(() => Sort$outboundSchema)).optional(), + field: z.array(z.lazy(() => Field$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + filter: "Filter", + sort: "Sort", + field: "Field", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryType$ { - export const inboundSchema: z.ZodType = z - .object({ - key: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - active: z.boolean().optional(), - Filter: z.array(z.lazy(() => GetLibraryFilter$.inboundSchema)).optional(), - Sort: z.array(z.lazy(() => Sort$.inboundSchema)).optional(), - Field: z.array(z.lazy(() => Field$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Filter: "filter", - Sort: "sort", - Field: "field", - }); - }); - - export type Outbound = { - key?: string | undefined; - type?: string | undefined; - title?: string | undefined; - active?: boolean | undefined; - Filter?: Array | undefined; - Sort?: Array | undefined; - Field?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - key: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - active: z.boolean().optional(), - filter: z.array(z.lazy(() => GetLibraryFilter$.outboundSchema)).optional(), - sort: z.array(z.lazy(() => Sort$.outboundSchema)).optional(), - field: z.array(z.lazy(() => Field$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - filter: "Filter", - sort: "Sort", - field: "Field", - }); - }); + /** @deprecated use `GetLibraryType$inboundSchema` instead. */ + export const inboundSchema = GetLibraryType$inboundSchema; + /** @deprecated use `GetLibraryType$outboundSchema` instead. */ + export const outboundSchema = GetLibraryType$outboundSchema; + /** @deprecated use `GetLibraryType$Outbound` instead. */ + export type Outbound = GetLibraryType$Outbound; } /** @internal */ +export const Operator$inboundSchema: z.ZodType = z.object({ + key: z.string().optional(), + title: z.string().optional(), +}); + +/** @internal */ +export type Operator$Outbound = { + key?: string | undefined; + title?: string | undefined; +}; + +/** @internal */ +export const Operator$outboundSchema: z.ZodType = + z.object({ + key: z.string().optional(), + title: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Operator$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - }); - - export type Outbound = { - key?: string | undefined; - title?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - }); + /** @deprecated use `Operator$inboundSchema` instead. */ + export const inboundSchema = Operator$inboundSchema; + /** @deprecated use `Operator$outboundSchema` instead. */ + export const outboundSchema = Operator$outboundSchema; + /** @deprecated use `Operator$Outbound` instead. */ + export type Outbound = Operator$Outbound; } /** @internal */ +export const FieldType$inboundSchema: z.ZodType = z + .object({ + type: z.string().optional(), + Operator: z.array(z.lazy(() => Operator$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Operator: "operator", + }); + }); + +/** @internal */ +export type FieldType$Outbound = { + type?: string | undefined; + Operator?: Array | undefined; +}; + +/** @internal */ +export const FieldType$outboundSchema: z.ZodType = z + .object({ + type: z.string().optional(), + operator: z.array(z.lazy(() => Operator$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + operator: "Operator", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace FieldType$ { - export const inboundSchema: z.ZodType = z - .object({ - type: z.string().optional(), - Operator: z.array(z.lazy(() => Operator$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Operator: "operator", - }); - }); - - export type Outbound = { - type?: string | undefined; - Operator?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - type: z.string().optional(), - operator: z.array(z.lazy(() => Operator$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - operator: "Operator", - }); - }); + /** @deprecated use `FieldType$inboundSchema` instead. */ + export const inboundSchema = FieldType$inboundSchema; + /** @deprecated use `FieldType$outboundSchema` instead. */ + export const outboundSchema = FieldType$outboundSchema; + /** @deprecated use `FieldType$Outbound` instead. */ + export type Outbound = FieldType$Outbound; } /** @internal */ +export const GetLibraryMediaContainer$inboundSchema: z.ZodType< + GetLibraryMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + content: z.string().optional(), + identifier: z.string().optional(), + librarySectionID: z.number().int().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + Directory: z.array(z.lazy(() => GetLibraryDirectory$inboundSchema)).optional(), + Type: z.array(z.lazy(() => GetLibraryType$inboundSchema)).optional(), + FieldType: z.array(z.lazy(() => FieldType$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Directory: "directory", + Type: "type", + FieldType: "fieldType", + }); + }); + +/** @internal */ +export type GetLibraryMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + art?: string | undefined; + content?: string | undefined; + identifier?: string | undefined; + librarySectionID?: number | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + thumb?: string | undefined; + title1?: string | undefined; + viewGroup?: string | undefined; + viewMode?: number | undefined; + Directory?: Array | undefined; + Type?: Array | undefined; + FieldType?: Array | undefined; +}; + +/** @internal */ +export const GetLibraryMediaContainer$outboundSchema: z.ZodType< + GetLibraryMediaContainer$Outbound, + z.ZodTypeDef, + GetLibraryMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + content: z.string().optional(), + identifier: z.string().optional(), + librarySectionID: z.number().int().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + directory: z.array(z.lazy(() => GetLibraryDirectory$outboundSchema)).optional(), + type: z.array(z.lazy(() => GetLibraryType$outboundSchema)).optional(), + fieldType: z.array(z.lazy(() => FieldType$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + directory: "Directory", + type: "Type", + fieldType: "FieldType", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - content: z.string().optional(), - identifier: z.string().optional(), - librarySectionID: z.number().int().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - Directory: z.array(z.lazy(() => GetLibraryDirectory$.inboundSchema)).optional(), - Type: z.array(z.lazy(() => GetLibraryType$.inboundSchema)).optional(), - FieldType: z.array(z.lazy(() => FieldType$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Directory: "directory", - Type: "type", - FieldType: "fieldType", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - art?: string | undefined; - content?: string | undefined; - identifier?: string | undefined; - librarySectionID?: number | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - thumb?: string | undefined; - title1?: string | undefined; - viewGroup?: string | undefined; - viewMode?: number | undefined; - Directory?: Array | undefined; - Type?: Array | undefined; - FieldType?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - content: z.string().optional(), - identifier: z.string().optional(), - librarySectionID: z.number().int().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - directory: z.array(z.lazy(() => GetLibraryDirectory$.outboundSchema)).optional(), - type: z.array(z.lazy(() => GetLibraryType$.outboundSchema)).optional(), - fieldType: z.array(z.lazy(() => FieldType$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - directory: "Directory", - type: "Type", - fieldType: "FieldType", - }); - }); + /** @deprecated use `GetLibraryMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetLibraryMediaContainer$inboundSchema; + /** @deprecated use `GetLibraryMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetLibraryMediaContainer$outboundSchema; + /** @deprecated use `GetLibraryMediaContainer$Outbound` instead. */ + export type Outbound = GetLibraryMediaContainer$Outbound; } /** @internal */ +export const GetLibraryResponseBody$inboundSchema: z.ZodType< + GetLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetLibraryMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetLibraryResponseBody$Outbound = { + MediaContainer?: GetLibraryMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetLibraryResponseBody$outboundSchema: z.ZodType< + GetLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetLibraryResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetLibraryMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetLibraryMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetLibraryMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetLibraryMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetLibraryResponseBody$inboundSchema; + /** @deprecated use `GetLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetLibraryResponseBody$outboundSchema; + /** @deprecated use `GetLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetLibraryResponseBody$Outbound; } /** @internal */ +export const GetLibraryResponse$inboundSchema: z.ZodType< + GetLibraryResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetLibraryResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetLibraryResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetLibraryResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetLibraryResponse$outboundSchema: z.ZodType< + GetLibraryResponse$Outbound, + z.ZodTypeDef, + GetLibraryResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetLibraryResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetLibraryResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetLibraryResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetLibraryResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetLibraryResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetLibraryResponse$inboundSchema` instead. */ + export const inboundSchema = GetLibraryResponse$inboundSchema; + /** @deprecated use `GetLibraryResponse$outboundSchema` instead. */ + export const outboundSchema = GetLibraryResponse$outboundSchema; + /** @deprecated use `GetLibraryResponse$Outbound` instead. */ + export type Outbound = GetLibraryResponse$Outbound; } diff --git a/src/models/getmetadatachildrenop.ts b/src/models/getmetadatachildrenop.ts index a444c889..d5e4b9b3 100644 --- a/src/models/getmetadatachildrenop.ts +++ b/src/models/getmetadatachildrenop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -50,7 +50,11 @@ export class GetMetadataChildrenLibraryResponseBody extends Error { data$: GetMetadataChildrenLibraryResponseBodyData; constructor(err: GetMetadataChildrenLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -60,11 +64,6 @@ export class GetMetadataChildrenLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetMetadataChildrenLibraryResponseBody"; } } @@ -160,405 +159,534 @@ export type GetMetadataChildrenResponse = { }; /** @internal */ +export const GetMetadataChildrenRequest$inboundSchema: z.ZodType< + GetMetadataChildrenRequest, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.number(), + includeElements: z.string().optional(), +}); + +/** @internal */ +export type GetMetadataChildrenRequest$Outbound = { + ratingKey: number; + includeElements?: string | undefined; +}; + +/** @internal */ +export const GetMetadataChildrenRequest$outboundSchema: z.ZodType< + GetMetadataChildrenRequest$Outbound, + z.ZodTypeDef, + GetMetadataChildrenRequest +> = z.object({ + ratingKey: z.number(), + includeElements: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataChildrenRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - ratingKey: z.number(), - includeElements: z.string().optional(), - }); - - export type Outbound = { - ratingKey: number; - includeElements?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - ratingKey: z.number(), - includeElements: z.string().optional(), - }); + /** @deprecated use `GetMetadataChildrenRequest$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenRequest$inboundSchema; + /** @deprecated use `GetMetadataChildrenRequest$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenRequest$outboundSchema; + /** @deprecated use `GetMetadataChildrenRequest$Outbound` instead. */ + export type Outbound = GetMetadataChildrenRequest$Outbound; } /** @internal */ +export const GetMetadataChildrenErrors$inboundSchema: z.ZodType< + GetMetadataChildrenErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetMetadataChildrenErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetMetadataChildrenErrors$outboundSchema: z.ZodType< + GetMetadataChildrenErrors$Outbound, + z.ZodTypeDef, + GetMetadataChildrenErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataChildrenErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetMetadataChildrenErrors$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenErrors$inboundSchema; + /** @deprecated use `GetMetadataChildrenErrors$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenErrors$outboundSchema; + /** @deprecated use `GetMetadataChildrenErrors$Outbound` instead. */ + export type Outbound = GetMetadataChildrenErrors$Outbound; } /** @internal */ -export namespace GetMetadataChildrenLibraryResponseBody$ { - export const inboundSchema: z.ZodType< - GetMetadataChildrenLibraryResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetMetadataChildrenErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetMetadataChildrenLibraryResponseBody(remapped); +export const GetMetadataChildrenLibraryResponseBody$inboundSchema: z.ZodType< + GetMetadataChildrenLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetMetadataChildrenErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetMetadataChildrenLibraryResponseBody - > = z - .instanceof(GetMetadataChildrenLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetMetadataChildrenErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new GetMetadataChildrenLibraryResponseBody(remapped); + }); /** @internal */ -export namespace GetMetadataChildrenDirectory$ { - export const inboundSchema: z.ZodType = - z.object({ - leafCount: z.number().int().optional(), - thumb: z.string().optional(), - viewedLeafCount: z.number().int().optional(), - key: z.string().optional(), - title: z.string().optional(), - }); - - export type Outbound = { - leafCount?: number | undefined; - thumb?: string | undefined; - viewedLeafCount?: number | undefined; - key?: string | undefined; - title?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - leafCount: z.number().int().optional(), - thumb: z.string().optional(), - viewedLeafCount: z.number().int().optional(), - key: z.string().optional(), - title: z.string().optional(), - }); -} +export type GetMetadataChildrenLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetMetadataChildrenMetadata$ { - export const inboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - parentRatingKey: z.string().optional(), - guid: z.string().optional(), - parentGuid: z.string().optional(), - parentStudio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - parentKey: z.string().optional(), - parentTitle: z.string().optional(), - summary: z.string().optional(), - index: z.number().int().optional(), - parentIndex: z.number().int().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - parentYear: z.number().int().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - parentThumb: z.string().optional(), - parentTheme: z.string().optional(), - leafCount: z.number().int().optional(), - viewedLeafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - userRating: z.number().int().optional(), - skipCount: z.number().int().optional(), - lastRatedAt: z.number().int().optional(), - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - parentRatingKey?: string | undefined; - guid?: string | undefined; - parentGuid?: string | undefined; - parentStudio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - parentKey?: string | undefined; - parentTitle?: string | undefined; - summary?: string | undefined; - index?: number | undefined; - parentIndex?: number | undefined; - viewCount?: number | undefined; - lastViewedAt?: number | undefined; - parentYear?: number | undefined; - thumb?: string | undefined; - art?: string | undefined; - parentThumb?: string | undefined; - parentTheme?: string | undefined; - leafCount?: number | undefined; - viewedLeafCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - userRating?: number | undefined; - skipCount?: number | undefined; - lastRatedAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - parentRatingKey: z.string().optional(), - guid: z.string().optional(), - parentGuid: z.string().optional(), - parentStudio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - parentKey: z.string().optional(), - parentTitle: z.string().optional(), - summary: z.string().optional(), - index: z.number().int().optional(), - parentIndex: z.number().int().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - parentYear: z.number().int().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - parentThumb: z.string().optional(), - parentTheme: z.string().optional(), - leafCount: z.number().int().optional(), - viewedLeafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - userRating: z.number().int().optional(), - skipCount: z.number().int().optional(), - lastRatedAt: z.number().int().optional(), - }); -} - -/** @internal */ -export namespace GetMetadataChildrenMediaContainer$ { - export const inboundSchema: z.ZodType< - GetMetadataChildrenMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - identifier: z.string().optional(), - key: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - nocache: z.boolean().optional(), - parentIndex: z.number().int().optional(), - parentTitle: z.string().optional(), - parentYear: z.number().int().optional(), - summary: z.string().optional(), - theme: z.string().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - title2: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - Directory: z - .array(z.lazy(() => GetMetadataChildrenDirectory$.inboundSchema)) - .optional(), - Metadata: z.array(z.lazy(() => GetMetadataChildrenMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Directory: "directory", - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - art?: string | undefined; - identifier?: string | undefined; - key?: string | undefined; - librarySectionID?: number | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - nocache?: boolean | undefined; - parentIndex?: number | undefined; - parentTitle?: string | undefined; - parentYear?: number | undefined; - summary?: string | undefined; - theme?: string | undefined; - thumb?: string | undefined; - title1?: string | undefined; - title2?: string | undefined; - viewGroup?: string | undefined; - viewMode?: number | undefined; - Directory?: Array | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetMetadataChildrenMediaContainer - > = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - identifier: z.string().optional(), - key: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - nocache: z.boolean().optional(), - parentIndex: z.number().int().optional(), - parentTitle: z.string().optional(), - parentYear: z.number().int().optional(), - summary: z.string().optional(), - theme: z.string().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - title2: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - directory: z - .array(z.lazy(() => GetMetadataChildrenDirectory$.outboundSchema)) - .optional(), - metadata: z.array(z.lazy(() => GetMetadataChildrenMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - directory: "Directory", - metadata: "Metadata", - }); - }); -} - -/** @internal */ -export namespace GetMetadataChildrenResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetMetadataChildrenLibraryResponseBody$outboundSchema: z.ZodType< + GetMetadataChildrenLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetMetadataChildrenLibraryResponseBody +> = z + .instanceof(GetMetadataChildrenLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => GetMetadataChildrenMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => GetMetadataChildrenErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: GetMetadataChildrenMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetMetadataChildrenResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetMetadataChildrenMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataChildrenLibraryResponseBody$ { + /** @deprecated use `GetMetadataChildrenLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenLibraryResponseBody$inboundSchema; + /** @deprecated use `GetMetadataChildrenLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenLibraryResponseBody$outboundSchema; + /** @deprecated use `GetMetadataChildrenLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetMetadataChildrenLibraryResponseBody$Outbound; } /** @internal */ -export namespace GetMetadataChildrenResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetMetadataChildrenResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const GetMetadataChildrenDirectory$inboundSchema: z.ZodType< + GetMetadataChildrenDirectory, + z.ZodTypeDef, + unknown +> = z.object({ + leafCount: z.number().int().optional(), + thumb: z.string().optional(), + viewedLeafCount: z.number().int().optional(), + key: z.string().optional(), + title: z.string().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetMetadataChildrenResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type GetMetadataChildrenDirectory$Outbound = { + leafCount?: number | undefined; + thumb?: string | undefined; + viewedLeafCount?: number | undefined; + key?: string | undefined; + title?: string | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetMetadataChildrenResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const GetMetadataChildrenDirectory$outboundSchema: z.ZodType< + GetMetadataChildrenDirectory$Outbound, + z.ZodTypeDef, + GetMetadataChildrenDirectory +> = z.object({ + leafCount: z.number().int().optional(), + thumb: z.string().optional(), + viewedLeafCount: z.number().int().optional(), + key: z.string().optional(), + title: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataChildrenDirectory$ { + /** @deprecated use `GetMetadataChildrenDirectory$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenDirectory$inboundSchema; + /** @deprecated use `GetMetadataChildrenDirectory$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenDirectory$outboundSchema; + /** @deprecated use `GetMetadataChildrenDirectory$Outbound` instead. */ + export type Outbound = GetMetadataChildrenDirectory$Outbound; +} + +/** @internal */ +export const GetMetadataChildrenMetadata$inboundSchema: z.ZodType< + GetMetadataChildrenMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + parentRatingKey: z.string().optional(), + guid: z.string().optional(), + parentGuid: z.string().optional(), + parentStudio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + parentKey: z.string().optional(), + parentTitle: z.string().optional(), + summary: z.string().optional(), + index: z.number().int().optional(), + parentIndex: z.number().int().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + parentYear: z.number().int().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + leafCount: z.number().int().optional(), + viewedLeafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + userRating: z.number().int().optional(), + skipCount: z.number().int().optional(), + lastRatedAt: z.number().int().optional(), +}); + +/** @internal */ +export type GetMetadataChildrenMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + parentRatingKey?: string | undefined; + guid?: string | undefined; + parentGuid?: string | undefined; + parentStudio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + parentKey?: string | undefined; + parentTitle?: string | undefined; + summary?: string | undefined; + index?: number | undefined; + parentIndex?: number | undefined; + viewCount?: number | undefined; + lastViewedAt?: number | undefined; + parentYear?: number | undefined; + thumb?: string | undefined; + art?: string | undefined; + parentThumb?: string | undefined; + parentTheme?: string | undefined; + leafCount?: number | undefined; + viewedLeafCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + userRating?: number | undefined; + skipCount?: number | undefined; + lastRatedAt?: number | undefined; +}; + +/** @internal */ +export const GetMetadataChildrenMetadata$outboundSchema: z.ZodType< + GetMetadataChildrenMetadata$Outbound, + z.ZodTypeDef, + GetMetadataChildrenMetadata +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + parentRatingKey: z.string().optional(), + guid: z.string().optional(), + parentGuid: z.string().optional(), + parentStudio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + parentKey: z.string().optional(), + parentTitle: z.string().optional(), + summary: z.string().optional(), + index: z.number().int().optional(), + parentIndex: z.number().int().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + parentYear: z.number().int().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + leafCount: z.number().int().optional(), + viewedLeafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + userRating: z.number().int().optional(), + skipCount: z.number().int().optional(), + lastRatedAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataChildrenMetadata$ { + /** @deprecated use `GetMetadataChildrenMetadata$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenMetadata$inboundSchema; + /** @deprecated use `GetMetadataChildrenMetadata$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenMetadata$outboundSchema; + /** @deprecated use `GetMetadataChildrenMetadata$Outbound` instead. */ + export type Outbound = GetMetadataChildrenMetadata$Outbound; +} + +/** @internal */ +export const GetMetadataChildrenMediaContainer$inboundSchema: z.ZodType< + GetMetadataChildrenMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + identifier: z.string().optional(), + key: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + nocache: z.boolean().optional(), + parentIndex: z.number().int().optional(), + parentTitle: z.string().optional(), + parentYear: z.number().int().optional(), + summary: z.string().optional(), + theme: z.string().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + title2: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + Directory: z.array(z.lazy(() => GetMetadataChildrenDirectory$inboundSchema)).optional(), + Metadata: z.array(z.lazy(() => GetMetadataChildrenMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Directory: "directory", + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetMetadataChildrenMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + art?: string | undefined; + identifier?: string | undefined; + key?: string | undefined; + librarySectionID?: number | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + nocache?: boolean | undefined; + parentIndex?: number | undefined; + parentTitle?: string | undefined; + parentYear?: number | undefined; + summary?: string | undefined; + theme?: string | undefined; + thumb?: string | undefined; + title1?: string | undefined; + title2?: string | undefined; + viewGroup?: string | undefined; + viewMode?: number | undefined; + Directory?: Array | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetMetadataChildrenMediaContainer$outboundSchema: z.ZodType< + GetMetadataChildrenMediaContainer$Outbound, + z.ZodTypeDef, + GetMetadataChildrenMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + identifier: z.string().optional(), + key: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + nocache: z.boolean().optional(), + parentIndex: z.number().int().optional(), + parentTitle: z.string().optional(), + parentYear: z.number().int().optional(), + summary: z.string().optional(), + theme: z.string().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + title2: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + directory: z.array(z.lazy(() => GetMetadataChildrenDirectory$outboundSchema)).optional(), + metadata: z.array(z.lazy(() => GetMetadataChildrenMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + directory: "Directory", + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataChildrenMediaContainer$ { + /** @deprecated use `GetMetadataChildrenMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenMediaContainer$inboundSchema; + /** @deprecated use `GetMetadataChildrenMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenMediaContainer$outboundSchema; + /** @deprecated use `GetMetadataChildrenMediaContainer$Outbound` instead. */ + export type Outbound = GetMetadataChildrenMediaContainer$Outbound; +} + +/** @internal */ +export const GetMetadataChildrenResponseBody$inboundSchema: z.ZodType< + GetMetadataChildrenResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetMetadataChildrenMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetMetadataChildrenResponseBody$Outbound = { + MediaContainer?: GetMetadataChildrenMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetMetadataChildrenResponseBody$outboundSchema: z.ZodType< + GetMetadataChildrenResponseBody$Outbound, + z.ZodTypeDef, + GetMetadataChildrenResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetMetadataChildrenMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataChildrenResponseBody$ { + /** @deprecated use `GetMetadataChildrenResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenResponseBody$inboundSchema; + /** @deprecated use `GetMetadataChildrenResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenResponseBody$outboundSchema; + /** @deprecated use `GetMetadataChildrenResponseBody$Outbound` instead. */ + export type Outbound = GetMetadataChildrenResponseBody$Outbound; +} + +/** @internal */ +export const GetMetadataChildrenResponse$inboundSchema: z.ZodType< + GetMetadataChildrenResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetMetadataChildrenResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetMetadataChildrenResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetMetadataChildrenResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetMetadataChildrenResponse$outboundSchema: z.ZodType< + GetMetadataChildrenResponse$Outbound, + z.ZodTypeDef, + GetMetadataChildrenResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetMetadataChildrenResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataChildrenResponse$ { + /** @deprecated use `GetMetadataChildrenResponse$inboundSchema` instead. */ + export const inboundSchema = GetMetadataChildrenResponse$inboundSchema; + /** @deprecated use `GetMetadataChildrenResponse$outboundSchema` instead. */ + export const outboundSchema = GetMetadataChildrenResponse$outboundSchema; + /** @deprecated use `GetMetadataChildrenResponse$Outbound` instead. */ + export type Outbound = GetMetadataChildrenResponse$Outbound; } diff --git a/src/models/getmetadataop.ts b/src/models/getmetadataop.ts index 59702a12..a68ac504 100644 --- a/src/models/getmetadataop.ts +++ b/src/models/getmetadataop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -44,7 +44,11 @@ export class GetMetadataLibraryResponseBody extends Error { data$: GetMetadataLibraryResponseBodyData; constructor(err: GetMetadataLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -54,11 +58,6 @@ export class GetMetadataLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetMetadataLibraryResponseBody"; } } @@ -262,770 +261,1100 @@ export type GetMetadataResponse = { }; /** @internal */ +export const GetMetadataRequest$inboundSchema: z.ZodType< + GetMetadataRequest, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.number(), +}); + +/** @internal */ +export type GetMetadataRequest$Outbound = { + ratingKey: number; +}; + +/** @internal */ +export const GetMetadataRequest$outboundSchema: z.ZodType< + GetMetadataRequest$Outbound, + z.ZodTypeDef, + GetMetadataRequest +> = z.object({ + ratingKey: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataRequest$ { - export const inboundSchema: z.ZodType = z.object({ - ratingKey: z.number(), - }); - - export type Outbound = { - ratingKey: number; - }; - - export const outboundSchema: z.ZodType = z.object({ - ratingKey: z.number(), - }); + /** @deprecated use `GetMetadataRequest$inboundSchema` instead. */ + export const inboundSchema = GetMetadataRequest$inboundSchema; + /** @deprecated use `GetMetadataRequest$outboundSchema` instead. */ + export const outboundSchema = GetMetadataRequest$outboundSchema; + /** @deprecated use `GetMetadataRequest$Outbound` instead. */ + export type Outbound = GetMetadataRequest$Outbound; } /** @internal */ +export const GetMetadataErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetMetadataErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetMetadataErrors$outboundSchema: z.ZodType< + GetMetadataErrors$Outbound, + z.ZodTypeDef, + GetMetadataErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetMetadataErrors$inboundSchema` instead. */ + export const inboundSchema = GetMetadataErrors$inboundSchema; + /** @deprecated use `GetMetadataErrors$outboundSchema` instead. */ + export const outboundSchema = GetMetadataErrors$outboundSchema; + /** @deprecated use `GetMetadataErrors$Outbound` instead. */ + export type Outbound = GetMetadataErrors$Outbound; } /** @internal */ -export namespace GetMetadataLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetMetadataErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetMetadataLibraryResponseBody(remapped); +export const GetMetadataLibraryResponseBody$inboundSchema: z.ZodType< + GetMetadataLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetMetadataErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new GetMetadataLibraryResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type GetMetadataLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetMetadataLibraryResponseBody$outboundSchema: z.ZodType< + GetMetadataLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetMetadataLibraryResponseBody +> = z + .instanceof(GetMetadataLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(GetMetadataLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetMetadataErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => GetMetadataErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetMetadataLibraryResponseBody$ { + /** @deprecated use `GetMetadataLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetMetadataLibraryResponseBody$inboundSchema; + /** @deprecated use `GetMetadataLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetMetadataLibraryResponseBody$outboundSchema; + /** @deprecated use `GetMetadataLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetMetadataLibraryResponseBody$Outbound; } /** @internal */ +export const Stream$inboundSchema: z.ZodType = z.object({ + id: z.number().int().optional(), + streamType: z.number().int().optional(), + default: z.boolean().optional(), + codec: z.string().optional(), + index: z.number().int().optional(), + bitrate: z.number().int().optional(), + bitDepth: z.number().int().optional(), + chromaLocation: z.string().optional(), + chromaSubsampling: z.string().optional(), + codedHeight: z.number().int().optional(), + codedWidth: z.number().int().optional(), + colorPrimaries: z.string().optional(), + colorRange: z.string().optional(), + colorSpace: z.string().optional(), + colorTrc: z.string().optional(), + frameRate: z.number().int().optional(), + hasScalingMatrix: z.boolean().optional(), + height: z.number().int().optional(), + level: z.number().int().optional(), + profile: z.string().optional(), + refFrames: z.number().int().optional(), + scanType: z.string().optional(), + streamIdentifier: z.string().optional(), + width: z.number().int().optional(), + displayTitle: z.string().optional(), + extendedDisplayTitle: z.string().optional(), + selected: z.boolean().optional(), + channels: z.number().int().optional(), + language: z.string().optional(), + languageTag: z.string().optional(), + languageCode: z.string().optional(), + samplingRate: z.number().int().optional(), +}); + +/** @internal */ +export type Stream$Outbound = { + id?: number | undefined; + streamType?: number | undefined; + default?: boolean | undefined; + codec?: string | undefined; + index?: number | undefined; + bitrate?: number | undefined; + bitDepth?: number | undefined; + chromaLocation?: string | undefined; + chromaSubsampling?: string | undefined; + codedHeight?: number | undefined; + codedWidth?: number | undefined; + colorPrimaries?: string | undefined; + colorRange?: string | undefined; + colorSpace?: string | undefined; + colorTrc?: string | undefined; + frameRate?: number | undefined; + hasScalingMatrix?: boolean | undefined; + height?: number | undefined; + level?: number | undefined; + profile?: string | undefined; + refFrames?: number | undefined; + scanType?: string | undefined; + streamIdentifier?: string | undefined; + width?: number | undefined; + displayTitle?: string | undefined; + extendedDisplayTitle?: string | undefined; + selected?: boolean | undefined; + channels?: number | undefined; + language?: string | undefined; + languageTag?: string | undefined; + languageCode?: string | undefined; + samplingRate?: number | undefined; +}; + +/** @internal */ +export const Stream$outboundSchema: z.ZodType = z.object({ + id: z.number().int().optional(), + streamType: z.number().int().optional(), + default: z.boolean().optional(), + codec: z.string().optional(), + index: z.number().int().optional(), + bitrate: z.number().int().optional(), + bitDepth: z.number().int().optional(), + chromaLocation: z.string().optional(), + chromaSubsampling: z.string().optional(), + codedHeight: z.number().int().optional(), + codedWidth: z.number().int().optional(), + colorPrimaries: z.string().optional(), + colorRange: z.string().optional(), + colorSpace: z.string().optional(), + colorTrc: z.string().optional(), + frameRate: z.number().int().optional(), + hasScalingMatrix: z.boolean().optional(), + height: z.number().int().optional(), + level: z.number().int().optional(), + profile: z.string().optional(), + refFrames: z.number().int().optional(), + scanType: z.string().optional(), + streamIdentifier: z.string().optional(), + width: z.number().int().optional(), + displayTitle: z.string().optional(), + extendedDisplayTitle: z.string().optional(), + selected: z.boolean().optional(), + channels: z.number().int().optional(), + language: z.string().optional(), + languageTag: z.string().optional(), + languageCode: z.string().optional(), + samplingRate: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Stream$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - streamType: z.number().int().optional(), - default: z.boolean().optional(), - codec: z.string().optional(), - index: z.number().int().optional(), - bitrate: z.number().int().optional(), - bitDepth: z.number().int().optional(), - chromaLocation: z.string().optional(), - chromaSubsampling: z.string().optional(), - codedHeight: z.number().int().optional(), - codedWidth: z.number().int().optional(), - colorPrimaries: z.string().optional(), - colorRange: z.string().optional(), - colorSpace: z.string().optional(), - colorTrc: z.string().optional(), - frameRate: z.number().int().optional(), - hasScalingMatrix: z.boolean().optional(), - height: z.number().int().optional(), - level: z.number().int().optional(), - profile: z.string().optional(), - refFrames: z.number().int().optional(), - scanType: z.string().optional(), - streamIdentifier: z.string().optional(), - width: z.number().int().optional(), - displayTitle: z.string().optional(), - extendedDisplayTitle: z.string().optional(), - selected: z.boolean().optional(), - channels: z.number().int().optional(), - language: z.string().optional(), - languageTag: z.string().optional(), - languageCode: z.string().optional(), - samplingRate: z.number().int().optional(), - }); - - export type Outbound = { - id?: number | undefined; - streamType?: number | undefined; - default?: boolean | undefined; - codec?: string | undefined; - index?: number | undefined; - bitrate?: number | undefined; - bitDepth?: number | undefined; - chromaLocation?: string | undefined; - chromaSubsampling?: string | undefined; - codedHeight?: number | undefined; - codedWidth?: number | undefined; - colorPrimaries?: string | undefined; - colorRange?: string | undefined; - colorSpace?: string | undefined; - colorTrc?: string | undefined; - frameRate?: number | undefined; - hasScalingMatrix?: boolean | undefined; - height?: number | undefined; - level?: number | undefined; - profile?: string | undefined; - refFrames?: number | undefined; - scanType?: string | undefined; - streamIdentifier?: string | undefined; - width?: number | undefined; - displayTitle?: string | undefined; - extendedDisplayTitle?: string | undefined; - selected?: boolean | undefined; - channels?: number | undefined; - language?: string | undefined; - languageTag?: string | undefined; - languageCode?: string | undefined; - samplingRate?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - streamType: z.number().int().optional(), - default: z.boolean().optional(), - codec: z.string().optional(), - index: z.number().int().optional(), - bitrate: z.number().int().optional(), - bitDepth: z.number().int().optional(), - chromaLocation: z.string().optional(), - chromaSubsampling: z.string().optional(), - codedHeight: z.number().int().optional(), - codedWidth: z.number().int().optional(), - colorPrimaries: z.string().optional(), - colorRange: z.string().optional(), - colorSpace: z.string().optional(), - colorTrc: z.string().optional(), - frameRate: z.number().int().optional(), - hasScalingMatrix: z.boolean().optional(), - height: z.number().int().optional(), - level: z.number().int().optional(), - profile: z.string().optional(), - refFrames: z.number().int().optional(), - scanType: z.string().optional(), - streamIdentifier: z.string().optional(), - width: z.number().int().optional(), - displayTitle: z.string().optional(), - extendedDisplayTitle: z.string().optional(), - selected: z.boolean().optional(), - channels: z.number().int().optional(), - language: z.string().optional(), - languageTag: z.string().optional(), - languageCode: z.string().optional(), - samplingRate: z.number().int().optional(), - }); + /** @deprecated use `Stream$inboundSchema` instead. */ + export const inboundSchema = Stream$inboundSchema; + /** @deprecated use `Stream$outboundSchema` instead. */ + export const outboundSchema = Stream$outboundSchema; + /** @deprecated use `Stream$Outbound` instead. */ + export type Outbound = Stream$Outbound; } /** @internal */ +export const GetMetadataPart$inboundSchema: z.ZodType = z + .object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), + Stream: z.array(z.lazy(() => Stream$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Stream: "stream", + }); + }); + +/** @internal */ +export type GetMetadataPart$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + audioProfile?: string | undefined; + container?: string | undefined; + has64bitOffsets?: boolean | undefined; + optimizedForStreaming?: boolean | undefined; + videoProfile?: string | undefined; + Stream?: Array | undefined; +}; + +/** @internal */ +export const GetMetadataPart$outboundSchema: z.ZodType< + GetMetadataPart$Outbound, + z.ZodTypeDef, + GetMetadataPart +> = z + .object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), + stream: z.array(z.lazy(() => Stream$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + stream: "Stream", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataPart$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - Stream: z.array(z.lazy(() => Stream$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Stream: "stream", - }); - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - audioProfile?: string | undefined; - container?: string | undefined; - has64bitOffsets?: boolean | undefined; - optimizedForStreaming?: boolean | undefined; - videoProfile?: string | undefined; - Stream?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - stream: z.array(z.lazy(() => Stream$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - stream: "Stream", - }); - }); + /** @deprecated use `GetMetadataPart$inboundSchema` instead. */ + export const inboundSchema = GetMetadataPart$inboundSchema; + /** @deprecated use `GetMetadataPart$outboundSchema` instead. */ + export const outboundSchema = GetMetadataPart$outboundSchema; + /** @deprecated use `GetMetadataPart$Outbound` instead. */ + export type Outbound = GetMetadataPart$Outbound; } /** @internal */ +export const GetMetadataMedia$inboundSchema: z.ZodType = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().int().optional(), + audioProfile: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => GetMetadataPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetMetadataMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: string | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + optimizedForStreaming?: number | undefined; + audioProfile?: string | undefined; + has64bitOffsets?: boolean | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetMetadataMedia$outboundSchema: z.ZodType< + GetMetadataMedia$Outbound, + z.ZodTypeDef, + GetMetadataMedia +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().int().optional(), + audioProfile: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => GetMetadataPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().int().optional(), - audioProfile: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => GetMetadataPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: string | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - optimizedForStreaming?: number | undefined; - audioProfile?: string | undefined; - has64bitOffsets?: boolean | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().int().optional(), - audioProfile: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => GetMetadataPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); + /** @deprecated use `GetMetadataMedia$inboundSchema` instead. */ + export const inboundSchema = GetMetadataMedia$inboundSchema; + /** @deprecated use `GetMetadataMedia$outboundSchema` instead. */ + export const outboundSchema = GetMetadataMedia$outboundSchema; + /** @deprecated use `GetMetadataMedia$Outbound` instead. */ + export type Outbound = GetMetadataMedia$Outbound; } /** @internal */ +export const GetMetadataGenre$inboundSchema: z.ZodType = + z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + }); + +/** @internal */ +export type GetMetadataGenre$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; +}; + +/** @internal */ +export const GetMetadataGenre$outboundSchema: z.ZodType< + GetMetadataGenre$Outbound, + z.ZodTypeDef, + GetMetadataGenre +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataGenre$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); + /** @deprecated use `GetMetadataGenre$inboundSchema` instead. */ + export const inboundSchema = GetMetadataGenre$inboundSchema; + /** @deprecated use `GetMetadataGenre$outboundSchema` instead. */ + export const outboundSchema = GetMetadataGenre$outboundSchema; + /** @deprecated use `GetMetadataGenre$Outbound` instead. */ + export type Outbound = GetMetadataGenre$Outbound; } /** @internal */ +export const GetMetadataCountry$inboundSchema: z.ZodType< + GetMetadataCountry, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** @internal */ +export type GetMetadataCountry$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; +}; + +/** @internal */ +export const GetMetadataCountry$outboundSchema: z.ZodType< + GetMetadataCountry$Outbound, + z.ZodTypeDef, + GetMetadataCountry +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataCountry$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); + /** @deprecated use `GetMetadataCountry$inboundSchema` instead. */ + export const inboundSchema = GetMetadataCountry$inboundSchema; + /** @deprecated use `GetMetadataCountry$outboundSchema` instead. */ + export const outboundSchema = GetMetadataCountry$outboundSchema; + /** @deprecated use `GetMetadataCountry$Outbound` instead. */ + export type Outbound = GetMetadataCountry$Outbound; } /** @internal */ +export const Guids$inboundSchema: z.ZodType = z.object({ + id: z.string().optional(), +}); + +/** @internal */ +export type Guids$Outbound = { + id?: string | undefined; +}; + +/** @internal */ +export const Guids$outboundSchema: z.ZodType = z.object({ + id: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Guids$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - }); - - export type Outbound = { - id?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - }); + /** @deprecated use `Guids$inboundSchema` instead. */ + export const inboundSchema = Guids$inboundSchema; + /** @deprecated use `Guids$outboundSchema` instead. */ + export const outboundSchema = Guids$outboundSchema; + /** @deprecated use `Guids$Outbound` instead. */ + export type Outbound = Guids$Outbound; } /** @internal */ +export const Ratings$inboundSchema: z.ZodType = z.object({ + image: z.string().optional(), + value: z.number().optional(), + type: z.string().optional(), +}); + +/** @internal */ +export type Ratings$Outbound = { + image?: string | undefined; + value?: number | undefined; + type?: string | undefined; +}; + +/** @internal */ +export const Ratings$outboundSchema: z.ZodType = z.object({ + image: z.string().optional(), + value: z.number().optional(), + type: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Ratings$ { - export const inboundSchema: z.ZodType = z.object({ - image: z.string().optional(), - value: z.number().optional(), - type: z.string().optional(), - }); - - export type Outbound = { - image?: string | undefined; - value?: number | undefined; - type?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - image: z.string().optional(), - value: z.number().optional(), - type: z.string().optional(), - }); + /** @deprecated use `Ratings$inboundSchema` instead. */ + export const inboundSchema = Ratings$inboundSchema; + /** @deprecated use `Ratings$outboundSchema` instead. */ + export const outboundSchema = Ratings$outboundSchema; + /** @deprecated use `Ratings$Outbound` instead. */ + export type Outbound = Ratings$Outbound; } /** @internal */ +export const GetMetadataDirector$inboundSchema: z.ZodType< + GetMetadataDirector, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + thumb: z.string().optional(), +}); + +/** @internal */ +export type GetMetadataDirector$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; + tagKey?: string | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const GetMetadataDirector$outboundSchema: z.ZodType< + GetMetadataDirector$Outbound, + z.ZodTypeDef, + GetMetadataDirector +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + thumb: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataDirector$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - tagKey?: string | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - thumb: z.string().optional(), - }); + /** @deprecated use `GetMetadataDirector$inboundSchema` instead. */ + export const inboundSchema = GetMetadataDirector$inboundSchema; + /** @deprecated use `GetMetadataDirector$outboundSchema` instead. */ + export const outboundSchema = GetMetadataDirector$outboundSchema; + /** @deprecated use `GetMetadataDirector$Outbound` instead. */ + export type Outbound = GetMetadataDirector$Outbound; } /** @internal */ +export const GetMetadataWriter$inboundSchema: z.ZodType = + z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + thumb: z.string().optional(), + }); + +/** @internal */ +export type GetMetadataWriter$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; + tagKey?: string | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const GetMetadataWriter$outboundSchema: z.ZodType< + GetMetadataWriter$Outbound, + z.ZodTypeDef, + GetMetadataWriter +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + thumb: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataWriter$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - tagKey?: string | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - thumb: z.string().optional(), - }); + /** @deprecated use `GetMetadataWriter$inboundSchema` instead. */ + export const inboundSchema = GetMetadataWriter$inboundSchema; + /** @deprecated use `GetMetadataWriter$outboundSchema` instead. */ + export const outboundSchema = GetMetadataWriter$outboundSchema; + /** @deprecated use `GetMetadataWriter$Outbound` instead. */ + export type Outbound = GetMetadataWriter$Outbound; } /** @internal */ +export const GetMetadataRole$inboundSchema: z.ZodType = + z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + role: z.string().optional(), + thumb: z.string().optional(), + }); + +/** @internal */ +export type GetMetadataRole$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; + tagKey?: string | undefined; + role?: string | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const GetMetadataRole$outboundSchema: z.ZodType< + GetMetadataRole$Outbound, + z.ZodTypeDef, + GetMetadataRole +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + role: z.string().optional(), + thumb: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataRole$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - role: z.string().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - tagKey?: string | undefined; - role?: string | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - role: z.string().optional(), - thumb: z.string().optional(), - }); + /** @deprecated use `GetMetadataRole$inboundSchema` instead. */ + export const inboundSchema = GetMetadataRole$inboundSchema; + /** @deprecated use `GetMetadataRole$outboundSchema` instead. */ + export const outboundSchema = GetMetadataRole$outboundSchema; + /** @deprecated use `GetMetadataRole$Outbound` instead. */ + export type Outbound = GetMetadataRole$Outbound; } /** @internal */ +export const Producer$inboundSchema: z.ZodType = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + thumb: z.string().optional(), +}); + +/** @internal */ +export type Producer$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; + tagKey?: string | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const Producer$outboundSchema: z.ZodType = + z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + thumb: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Producer$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - tagKey?: string | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - thumb: z.string().optional(), - }); + /** @deprecated use `Producer$inboundSchema` instead. */ + export const inboundSchema = Producer$inboundSchema; + /** @deprecated use `Producer$outboundSchema` instead. */ + export const outboundSchema = Producer$outboundSchema; + /** @deprecated use `Producer$Outbound` instead. */ + export type Outbound = Producer$Outbound; } /** @internal */ +export const GetMetadataMetadata$inboundSchema: z.ZodType< + GetMetadataMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + hasPremiumPrimaryExtra: z.string().optional(), + ratingImage: z.string().optional(), + Media: z.array(z.lazy(() => GetMetadataMedia$inboundSchema)).optional(), + Genre: z.array(z.lazy(() => GetMetadataGenre$inboundSchema)).optional(), + Country: z.array(z.lazy(() => GetMetadataCountry$inboundSchema)).optional(), + Guid: z.array(z.lazy(() => Guids$inboundSchema)).optional(), + Rating: z.array(z.lazy(() => Ratings$inboundSchema)).optional(), + Director: z.array(z.lazy(() => GetMetadataDirector$inboundSchema)).optional(), + Writer: z.array(z.lazy(() => GetMetadataWriter$inboundSchema)).optional(), + Role: z.array(z.lazy(() => GetMetadataRole$inboundSchema)).optional(), + Producer: z.array(z.lazy(() => Producer$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + Genre: "genre", + Country: "country", + Guid: "guids", + Rating: "ratings", + Director: "director", + Writer: "writer", + Role: "role", + Producer: "producer", + }); + }); + +/** @internal */ +export type GetMetadataMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + librarySectionTitle?: string | undefined; + librarySectionID?: number | undefined; + librarySectionKey?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + rating?: number | undefined; + audienceRating?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + audienceRatingImage?: string | undefined; + hasPremiumPrimaryExtra?: string | undefined; + ratingImage?: string | undefined; + Media?: Array | undefined; + Genre?: Array | undefined; + Country?: Array | undefined; + Guid?: Array | undefined; + Rating?: Array | undefined; + Director?: Array | undefined; + Writer?: Array | undefined; + Role?: Array | undefined; + Producer?: Array | undefined; +}; + +/** @internal */ +export const GetMetadataMetadata$outboundSchema: z.ZodType< + GetMetadataMetadata$Outbound, + z.ZodTypeDef, + GetMetadataMetadata +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + hasPremiumPrimaryExtra: z.string().optional(), + ratingImage: z.string().optional(), + media: z.array(z.lazy(() => GetMetadataMedia$outboundSchema)).optional(), + genre: z.array(z.lazy(() => GetMetadataGenre$outboundSchema)).optional(), + country: z.array(z.lazy(() => GetMetadataCountry$outboundSchema)).optional(), + guids: z.array(z.lazy(() => Guids$outboundSchema)).optional(), + ratings: z.array(z.lazy(() => Ratings$outboundSchema)).optional(), + director: z.array(z.lazy(() => GetMetadataDirector$outboundSchema)).optional(), + writer: z.array(z.lazy(() => GetMetadataWriter$outboundSchema)).optional(), + role: z.array(z.lazy(() => GetMetadataRole$outboundSchema)).optional(), + producer: z.array(z.lazy(() => Producer$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + genre: "Genre", + country: "Country", + guids: "Guid", + ratings: "Rating", + director: "Director", + writer: "Writer", + role: "Role", + producer: "Producer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - hasPremiumPrimaryExtra: z.string().optional(), - ratingImage: z.string().optional(), - Media: z.array(z.lazy(() => GetMetadataMedia$.inboundSchema)).optional(), - Genre: z.array(z.lazy(() => GetMetadataGenre$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => GetMetadataCountry$.inboundSchema)).optional(), - guids: z.array(z.lazy(() => Guids$.inboundSchema)).optional(), - ratings: z.array(z.lazy(() => Ratings$.inboundSchema)).optional(), - Director: z.array(z.lazy(() => GetMetadataDirector$.inboundSchema)).optional(), - Writer: z.array(z.lazy(() => GetMetadataWriter$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => GetMetadataRole$.inboundSchema)).optional(), - Producer: z.array(z.lazy(() => Producer$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - Genre: "genre", - Country: "country", - Director: "director", - Writer: "writer", - Role: "role", - Producer: "producer", - }); - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - librarySectionTitle?: string | undefined; - librarySectionID?: number | undefined; - librarySectionKey?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - rating?: number | undefined; - audienceRating?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - audienceRatingImage?: string | undefined; - hasPremiumPrimaryExtra?: string | undefined; - ratingImage?: string | undefined; - Media?: Array | undefined; - Genre?: Array | undefined; - Country?: Array | undefined; - guids?: Array | undefined; - ratings?: Array | undefined; - Director?: Array | undefined; - Writer?: Array | undefined; - Role?: Array | undefined; - Producer?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - hasPremiumPrimaryExtra: z.string().optional(), - ratingImage: z.string().optional(), - media: z.array(z.lazy(() => GetMetadataMedia$.outboundSchema)).optional(), - genre: z.array(z.lazy(() => GetMetadataGenre$.outboundSchema)).optional(), - country: z.array(z.lazy(() => GetMetadataCountry$.outboundSchema)).optional(), - guids: z.array(z.lazy(() => Guids$.outboundSchema)).optional(), - ratings: z.array(z.lazy(() => Ratings$.outboundSchema)).optional(), - director: z.array(z.lazy(() => GetMetadataDirector$.outboundSchema)).optional(), - writer: z.array(z.lazy(() => GetMetadataWriter$.outboundSchema)).optional(), - role: z.array(z.lazy(() => GetMetadataRole$.outboundSchema)).optional(), - producer: z.array(z.lazy(() => Producer$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - genre: "Genre", - country: "Country", - director: "Director", - writer: "Writer", - role: "Role", - producer: "Producer", - }); - }); + /** @deprecated use `GetMetadataMetadata$inboundSchema` instead. */ + export const inboundSchema = GetMetadataMetadata$inboundSchema; + /** @deprecated use `GetMetadataMetadata$outboundSchema` instead. */ + export const outboundSchema = GetMetadataMetadata$outboundSchema; + /** @deprecated use `GetMetadataMetadata$Outbound` instead. */ + export type Outbound = GetMetadataMetadata$Outbound; } /** @internal */ +export const GetMetadataMediaContainer$inboundSchema: z.ZodType< + GetMetadataMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + Metadata: z.array(z.lazy(() => GetMetadataMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetMetadataMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + identifier?: string | undefined; + librarySectionID?: number | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetMetadataMediaContainer$outboundSchema: z.ZodType< + GetMetadataMediaContainer$Outbound, + z.ZodTypeDef, + GetMetadataMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + metadata: z.array(z.lazy(() => GetMetadataMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - Metadata: z.array(z.lazy(() => GetMetadataMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - identifier?: string | undefined; - librarySectionID?: number | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - metadata: z.array(z.lazy(() => GetMetadataMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetMetadataMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetMetadataMediaContainer$inboundSchema; + /** @deprecated use `GetMetadataMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetMetadataMediaContainer$outboundSchema; + /** @deprecated use `GetMetadataMediaContainer$Outbound` instead. */ + export type Outbound = GetMetadataMediaContainer$Outbound; } /** @internal */ +export const GetMetadataResponseBody$inboundSchema: z.ZodType< + GetMetadataResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetMetadataMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetMetadataResponseBody$Outbound = { + MediaContainer?: GetMetadataMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetMetadataResponseBody$outboundSchema: z.ZodType< + GetMetadataResponseBody$Outbound, + z.ZodTypeDef, + GetMetadataResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetMetadataMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetMetadataMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetMetadataMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetMetadataMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetMetadataResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetMetadataResponseBody$inboundSchema; + /** @deprecated use `GetMetadataResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetMetadataResponseBody$outboundSchema; + /** @deprecated use `GetMetadataResponseBody$Outbound` instead. */ + export type Outbound = GetMetadataResponseBody$Outbound; } /** @internal */ +export const GetMetadataResponse$inboundSchema: z.ZodType< + GetMetadataResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetMetadataResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetMetadataResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetMetadataResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetMetadataResponse$outboundSchema: z.ZodType< + GetMetadataResponse$Outbound, + z.ZodTypeDef, + GetMetadataResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetMetadataResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMetadataResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetMetadataResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetMetadataResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetMetadataResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetMetadataResponse$inboundSchema` instead. */ + export const inboundSchema = GetMetadataResponse$inboundSchema; + /** @deprecated use `GetMetadataResponse$outboundSchema` instead. */ + export const outboundSchema = GetMetadataResponse$outboundSchema; + /** @deprecated use `GetMetadataResponse$Outbound` instead. */ + export type Outbound = GetMetadataResponse$Outbound; } diff --git a/src/models/getmyplexaccountop.ts b/src/models/getmyplexaccountop.ts index 73c88525..f4d58f21 100644 --- a/src/models/getmyplexaccountop.ts +++ b/src/models/getmyplexaccountop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetMyPlexAccountServerResponseBody extends Error { data$: GetMyPlexAccountServerResponseBodyData; constructor(err: GetMyPlexAccountServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetMyPlexAccountServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetMyPlexAccountServerResponseBody"; } } @@ -97,194 +96,278 @@ export type GetMyPlexAccountResponse = { }; /** @internal */ +export const GetMyPlexAccountErrors$inboundSchema: z.ZodType< + GetMyPlexAccountErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetMyPlexAccountErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetMyPlexAccountErrors$outboundSchema: z.ZodType< + GetMyPlexAccountErrors$Outbound, + z.ZodTypeDef, + GetMyPlexAccountErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMyPlexAccountErrors$ { - export const inboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } + /** @deprecated use `GetMyPlexAccountErrors$inboundSchema` instead. */ + export const inboundSchema = GetMyPlexAccountErrors$inboundSchema; + /** @deprecated use `GetMyPlexAccountErrors$outboundSchema` instead. */ + export const outboundSchema = GetMyPlexAccountErrors$outboundSchema; + /** @deprecated use `GetMyPlexAccountErrors$Outbound` instead. */ + export type Outbound = GetMyPlexAccountErrors$Outbound; +} + +/** @internal */ +export const GetMyPlexAccountServerResponseBody$inboundSchema: z.ZodType< + GetMyPlexAccountServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetMyPlexAccountErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetMyPlexAccountServerResponseBody(remapped); + }); + +/** @internal */ +export type GetMyPlexAccountServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetMyPlexAccountServerResponseBody$outboundSchema: z.ZodType< + GetMyPlexAccountServerResponseBody$Outbound, + z.ZodTypeDef, + GetMyPlexAccountServerResponseBody +> = z + .instanceof(GetMyPlexAccountServerResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetMyPlexAccountErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} - -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMyPlexAccountServerResponseBody$ { - export const inboundSchema: z.ZodType< - GetMyPlexAccountServerResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetMyPlexAccountErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetMyPlexAccountServerResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetMyPlexAccountServerResponseBody - > = z - .instanceof(GetMyPlexAccountServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetMyPlexAccountErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetMyPlexAccountServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetMyPlexAccountServerResponseBody$inboundSchema; + /** @deprecated use `GetMyPlexAccountServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetMyPlexAccountServerResponseBody$outboundSchema; + /** @deprecated use `GetMyPlexAccountServerResponseBody$Outbound` instead. */ + export type Outbound = GetMyPlexAccountServerResponseBody$Outbound; } /** @internal */ +export const MyPlex$inboundSchema: z.ZodType = z.object({ + authToken: z.string().optional(), + username: z.string().optional(), + mappingState: z.string().optional(), + mappingError: z.string().optional(), + signInState: z.string().optional(), + publicAddress: z.string().optional(), + publicPort: z.number().optional(), + privateAddress: z.string().optional(), + privatePort: z.number().optional(), + subscriptionFeatures: z.string().optional(), + subscriptionActive: z.boolean().optional(), + subscriptionState: z.string().optional(), +}); + +/** @internal */ +export type MyPlex$Outbound = { + authToken?: string | undefined; + username?: string | undefined; + mappingState?: string | undefined; + mappingError?: string | undefined; + signInState?: string | undefined; + publicAddress?: string | undefined; + publicPort?: number | undefined; + privateAddress?: string | undefined; + privatePort?: number | undefined; + subscriptionFeatures?: string | undefined; + subscriptionActive?: boolean | undefined; + subscriptionState?: string | undefined; +}; + +/** @internal */ +export const MyPlex$outboundSchema: z.ZodType = z.object({ + authToken: z.string().optional(), + username: z.string().optional(), + mappingState: z.string().optional(), + mappingError: z.string().optional(), + signInState: z.string().optional(), + publicAddress: z.string().optional(), + publicPort: z.number().optional(), + privateAddress: z.string().optional(), + privatePort: z.number().optional(), + subscriptionFeatures: z.string().optional(), + subscriptionActive: z.boolean().optional(), + subscriptionState: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MyPlex$ { - export const inboundSchema: z.ZodType = z.object({ - authToken: z.string().optional(), - username: z.string().optional(), - mappingState: z.string().optional(), - mappingError: z.string().optional(), - signInState: z.string().optional(), - publicAddress: z.string().optional(), - publicPort: z.number().optional(), - privateAddress: z.string().optional(), - privatePort: z.number().optional(), - subscriptionFeatures: z.string().optional(), - subscriptionActive: z.boolean().optional(), - subscriptionState: z.string().optional(), - }); - - export type Outbound = { - authToken?: string | undefined; - username?: string | undefined; - mappingState?: string | undefined; - mappingError?: string | undefined; - signInState?: string | undefined; - publicAddress?: string | undefined; - publicPort?: number | undefined; - privateAddress?: string | undefined; - privatePort?: number | undefined; - subscriptionFeatures?: string | undefined; - subscriptionActive?: boolean | undefined; - subscriptionState?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - authToken: z.string().optional(), - username: z.string().optional(), - mappingState: z.string().optional(), - mappingError: z.string().optional(), - signInState: z.string().optional(), - publicAddress: z.string().optional(), - publicPort: z.number().optional(), - privateAddress: z.string().optional(), - privatePort: z.number().optional(), - subscriptionFeatures: z.string().optional(), - subscriptionActive: z.boolean().optional(), - subscriptionState: z.string().optional(), - }); + /** @deprecated use `MyPlex$inboundSchema` instead. */ + export const inboundSchema = MyPlex$inboundSchema; + /** @deprecated use `MyPlex$outboundSchema` instead. */ + export const outboundSchema = MyPlex$outboundSchema; + /** @deprecated use `MyPlex$Outbound` instead. */ + export type Outbound = MyPlex$Outbound; } /** @internal */ +export const GetMyPlexAccountResponseBody$inboundSchema: z.ZodType< + GetMyPlexAccountResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MyPlex: z.lazy(() => MyPlex$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MyPlex: "myPlex", + }); + }); + +/** @internal */ +export type GetMyPlexAccountResponseBody$Outbound = { + MyPlex?: MyPlex$Outbound | undefined; +}; + +/** @internal */ +export const GetMyPlexAccountResponseBody$outboundSchema: z.ZodType< + GetMyPlexAccountResponseBody$Outbound, + z.ZodTypeDef, + GetMyPlexAccountResponseBody +> = z + .object({ + myPlex: z.lazy(() => MyPlex$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + myPlex: "MyPlex", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMyPlexAccountResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MyPlex: z.lazy(() => MyPlex$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MyPlex: "myPlex", - }); - }); - - export type Outbound = { - MyPlex?: MyPlex$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - myPlex: z.lazy(() => MyPlex$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - myPlex: "MyPlex", - }); - }); + /** @deprecated use `GetMyPlexAccountResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetMyPlexAccountResponseBody$inboundSchema; + /** @deprecated use `GetMyPlexAccountResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetMyPlexAccountResponseBody$outboundSchema; + /** @deprecated use `GetMyPlexAccountResponseBody$Outbound` instead. */ + export type Outbound = GetMyPlexAccountResponseBody$Outbound; } /** @internal */ +export const GetMyPlexAccountResponse$inboundSchema: z.ZodType< + GetMyPlexAccountResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetMyPlexAccountResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetMyPlexAccountResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetMyPlexAccountResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetMyPlexAccountResponse$outboundSchema: z.ZodType< + GetMyPlexAccountResponse$Outbound, + z.ZodTypeDef, + GetMyPlexAccountResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetMyPlexAccountResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetMyPlexAccountResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetMyPlexAccountResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetMyPlexAccountResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetMyPlexAccountResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetMyPlexAccountResponse$inboundSchema` instead. */ + export const inboundSchema = GetMyPlexAccountResponse$inboundSchema; + /** @deprecated use `GetMyPlexAccountResponse$outboundSchema` instead. */ + export const outboundSchema = GetMyPlexAccountResponse$outboundSchema; + /** @deprecated use `GetMyPlexAccountResponse$Outbound` instead. */ + export type Outbound = GetMyPlexAccountResponse$Outbound; } diff --git a/src/models/getondeckop.ts b/src/models/getondeckop.ts index e131dd67..4cbd64c4 100644 --- a/src/models/getondeckop.ts +++ b/src/models/getondeckop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetOnDeckLibraryResponseBody extends Error { data$: GetOnDeckLibraryResponseBodyData; constructor(err: GetOnDeckLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetOnDeckLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetOnDeckLibraryResponseBody"; } } @@ -191,287 +190,396 @@ export type GetOnDeckResponse = { }; /** @internal */ +export const GetOnDeckErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetOnDeckErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetOnDeckErrors$outboundSchema: z.ZodType< + GetOnDeckErrors$Outbound, + z.ZodTypeDef, + GetOnDeckErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetOnDeckErrors$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckErrors$inboundSchema; + /** @deprecated use `GetOnDeckErrors$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckErrors$outboundSchema; + /** @deprecated use `GetOnDeckErrors$Outbound` instead. */ + export type Outbound = GetOnDeckErrors$Outbound; } /** @internal */ +export const GetOnDeckLibraryResponseBody$inboundSchema: z.ZodType< + GetOnDeckLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetOnDeckErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetOnDeckLibraryResponseBody(remapped); + }); + +/** @internal */ +export type GetOnDeckLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetOnDeckLibraryResponseBody$outboundSchema: z.ZodType< + GetOnDeckLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetOnDeckLibraryResponseBody +> = z + .instanceof(GetOnDeckLibraryResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetOnDeckErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetOnDeckErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetOnDeckLibraryResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetOnDeckLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetOnDeckErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetOnDeckLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckLibraryResponseBody$inboundSchema; + /** @deprecated use `GetOnDeckLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckLibraryResponseBody$outboundSchema; + /** @deprecated use `GetOnDeckLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetOnDeckLibraryResponseBody$Outbound; } /** @internal */ +export const GetOnDeckStream$inboundSchema: z.ZodType = + z.object({ + id: z.number().optional(), + streamType: z.number().optional(), + default: z.boolean().optional(), + codec: z.string().optional(), + index: z.number().optional(), + bitrate: z.number().optional(), + language: z.string().optional(), + languageTag: z.string().optional(), + languageCode: z.string().optional(), + bitDepth: z.number().optional(), + chromaLocation: z.string().optional(), + chromaSubsampling: z.string().optional(), + codedHeight: z.number().optional(), + codedWidth: z.number().optional(), + colorRange: z.string().optional(), + frameRate: z.number().optional(), + height: z.number().optional(), + level: z.number().optional(), + profile: z.string().optional(), + refFrames: z.number().optional(), + width: z.number().optional(), + displayTitle: z.string().optional(), + extendedDisplayTitle: z.string().optional(), + }); + +/** @internal */ +export type GetOnDeckStream$Outbound = { + id?: number | undefined; + streamType?: number | undefined; + default?: boolean | undefined; + codec?: string | undefined; + index?: number | undefined; + bitrate?: number | undefined; + language?: string | undefined; + languageTag?: string | undefined; + languageCode?: string | undefined; + bitDepth?: number | undefined; + chromaLocation?: string | undefined; + chromaSubsampling?: string | undefined; + codedHeight?: number | undefined; + codedWidth?: number | undefined; + colorRange?: string | undefined; + frameRate?: number | undefined; + height?: number | undefined; + level?: number | undefined; + profile?: string | undefined; + refFrames?: number | undefined; + width?: number | undefined; + displayTitle?: string | undefined; + extendedDisplayTitle?: string | undefined; +}; + +/** @internal */ +export const GetOnDeckStream$outboundSchema: z.ZodType< + GetOnDeckStream$Outbound, + z.ZodTypeDef, + GetOnDeckStream +> = z.object({ + id: z.number().optional(), + streamType: z.number().optional(), + default: z.boolean().optional(), + codec: z.string().optional(), + index: z.number().optional(), + bitrate: z.number().optional(), + language: z.string().optional(), + languageTag: z.string().optional(), + languageCode: z.string().optional(), + bitDepth: z.number().optional(), + chromaLocation: z.string().optional(), + chromaSubsampling: z.string().optional(), + codedHeight: z.number().optional(), + codedWidth: z.number().optional(), + colorRange: z.string().optional(), + frameRate: z.number().optional(), + height: z.number().optional(), + level: z.number().optional(), + profile: z.string().optional(), + refFrames: z.number().optional(), + width: z.number().optional(), + displayTitle: z.string().optional(), + extendedDisplayTitle: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckStream$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - streamType: z.number().optional(), - default: z.boolean().optional(), - codec: z.string().optional(), - index: z.number().optional(), - bitrate: z.number().optional(), - language: z.string().optional(), - languageTag: z.string().optional(), - languageCode: z.string().optional(), - bitDepth: z.number().optional(), - chromaLocation: z.string().optional(), - chromaSubsampling: z.string().optional(), - codedHeight: z.number().optional(), - codedWidth: z.number().optional(), - colorRange: z.string().optional(), - frameRate: z.number().optional(), - height: z.number().optional(), - level: z.number().optional(), - profile: z.string().optional(), - refFrames: z.number().optional(), - width: z.number().optional(), - displayTitle: z.string().optional(), - extendedDisplayTitle: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - streamType?: number | undefined; - default?: boolean | undefined; - codec?: string | undefined; - index?: number | undefined; - bitrate?: number | undefined; - language?: string | undefined; - languageTag?: string | undefined; - languageCode?: string | undefined; - bitDepth?: number | undefined; - chromaLocation?: string | undefined; - chromaSubsampling?: string | undefined; - codedHeight?: number | undefined; - codedWidth?: number | undefined; - colorRange?: string | undefined; - frameRate?: number | undefined; - height?: number | undefined; - level?: number | undefined; - profile?: string | undefined; - refFrames?: number | undefined; - width?: number | undefined; - displayTitle?: string | undefined; - extendedDisplayTitle?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - streamType: z.number().optional(), - default: z.boolean().optional(), - codec: z.string().optional(), - index: z.number().optional(), - bitrate: z.number().optional(), - language: z.string().optional(), - languageTag: z.string().optional(), - languageCode: z.string().optional(), - bitDepth: z.number().optional(), - chromaLocation: z.string().optional(), - chromaSubsampling: z.string().optional(), - codedHeight: z.number().optional(), - codedWidth: z.number().optional(), - colorRange: z.string().optional(), - frameRate: z.number().optional(), - height: z.number().optional(), - level: z.number().optional(), - profile: z.string().optional(), - refFrames: z.number().optional(), - width: z.number().optional(), - displayTitle: z.string().optional(), - extendedDisplayTitle: z.string().optional(), - }); + /** @deprecated use `GetOnDeckStream$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckStream$inboundSchema; + /** @deprecated use `GetOnDeckStream$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckStream$outboundSchema; + /** @deprecated use `GetOnDeckStream$Outbound` instead. */ + export type Outbound = GetOnDeckStream$Outbound; } /** @internal */ +export const GetOnDeckPart$inboundSchema: z.ZodType = z + .object({ + id: z.number().optional(), + key: z.string().optional(), + duration: z.number().optional(), + file: z.string().optional(), + size: z.number().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + videoProfile: z.string().optional(), + Stream: z.array(z.lazy(() => GetOnDeckStream$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Stream: "stream", + }); + }); + +/** @internal */ +export type GetOnDeckPart$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + audioProfile?: string | undefined; + container?: string | undefined; + videoProfile?: string | undefined; + Stream?: Array | undefined; +}; + +/** @internal */ +export const GetOnDeckPart$outboundSchema: z.ZodType< + GetOnDeckPart$Outbound, + z.ZodTypeDef, + GetOnDeckPart +> = z + .object({ + id: z.number().optional(), + key: z.string().optional(), + duration: z.number().optional(), + file: z.string().optional(), + size: z.number().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + videoProfile: z.string().optional(), + stream: z.array(z.lazy(() => GetOnDeckStream$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + stream: "Stream", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckPart$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - key: z.string().optional(), - duration: z.number().optional(), - file: z.string().optional(), - size: z.number().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - videoProfile: z.string().optional(), - Stream: z.array(z.lazy(() => GetOnDeckStream$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Stream: "stream", - }); - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - audioProfile?: string | undefined; - container?: string | undefined; - videoProfile?: string | undefined; - Stream?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - key: z.string().optional(), - duration: z.number().optional(), - file: z.string().optional(), - size: z.number().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - videoProfile: z.string().optional(), - stream: z.array(z.lazy(() => GetOnDeckStream$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - stream: "Stream", - }); - }); + /** @deprecated use `GetOnDeckPart$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckPart$inboundSchema; + /** @deprecated use `GetOnDeckPart$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckPart$outboundSchema; + /** @deprecated use `GetOnDeckPart$Outbound` instead. */ + export type Outbound = GetOnDeckPart$Outbound; } /** @internal */ +export const GetOnDeckMedia$inboundSchema: z.ZodType = z + .object({ + id: z.number().optional(), + duration: z.number().optional(), + bitrate: z.number().optional(), + width: z.number().optional(), + height: z.number().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + audioProfile: z.string().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => GetOnDeckPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetOnDeckMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: string | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + audioProfile?: string | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetOnDeckMedia$outboundSchema: z.ZodType< + GetOnDeckMedia$Outbound, + z.ZodTypeDef, + GetOnDeckMedia +> = z + .object({ + id: z.number().optional(), + duration: z.number().optional(), + bitrate: z.number().optional(), + width: z.number().optional(), + height: z.number().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + audioProfile: z.string().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => GetOnDeckPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - duration: z.number().optional(), - bitrate: z.number().optional(), - width: z.number().optional(), - height: z.number().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - audioProfile: z.string().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => GetOnDeckPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: string | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - audioProfile?: string | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - duration: z.number().optional(), - bitrate: z.number().optional(), - width: z.number().optional(), - height: z.number().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - audioProfile: z.string().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => GetOnDeckPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); + /** @deprecated use `GetOnDeckMedia$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckMedia$inboundSchema; + /** @deprecated use `GetOnDeckMedia$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckMedia$outboundSchema; + /** @deprecated use `GetOnDeckMedia$Outbound` instead. */ + export type Outbound = GetOnDeckMedia$Outbound; } /** @internal */ +export const GetOnDeckGuids$inboundSchema: z.ZodType = + z.object({ + id: z.string().optional(), + }); + +/** @internal */ +export type GetOnDeckGuids$Outbound = { + id?: string | undefined; +}; + +/** @internal */ +export const GetOnDeckGuids$outboundSchema: z.ZodType< + GetOnDeckGuids$Outbound, + z.ZodTypeDef, + GetOnDeckGuids +> = z.object({ + id: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckGuids$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - }); - - export type Outbound = { - id?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - }); + /** @deprecated use `GetOnDeckGuids$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckGuids$inboundSchema; + /** @deprecated use `GetOnDeckGuids$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckGuids$outboundSchema; + /** @deprecated use `GetOnDeckGuids$Outbound` instead. */ + export type Outbound = GetOnDeckGuids$Outbound; } /** @internal */ -export namespace GetOnDeckMetadata$ { - export const inboundSchema: z.ZodType = z +export const GetOnDeckMetadata$inboundSchema: z.ZodType = + z .object({ allowSync: z.boolean().optional(), librarySectionID: z.number().optional(), @@ -511,183 +619,245 @@ export namespace GetOnDeckMetadata$ { .optional(), addedAt: z.number().optional(), updatedAt: z.number().optional(), - Media: z.array(z.lazy(() => GetOnDeckMedia$.inboundSchema)).optional(), - guids: z.array(z.lazy(() => GetOnDeckGuids$.inboundSchema)).optional(), + Media: z.array(z.lazy(() => GetOnDeckMedia$inboundSchema)).optional(), + Guid: z.array(z.lazy(() => GetOnDeckGuids$inboundSchema)).optional(), }) .transform((v) => { return remap$(v, { Media: "media", + Guid: "guids", }); }); - export type Outbound = { - allowSync?: boolean | undefined; - librarySectionID?: number | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - ratingKey?: number | undefined; - key?: string | undefined; - parentRatingKey?: number | undefined; - grandparentRatingKey?: number | undefined; - guid?: string | undefined; - parentGuid?: string | undefined; - grandparentGuid?: string | undefined; - type?: string | undefined; - title?: string | undefined; - grandparentKey?: string | undefined; - parentKey?: string | undefined; - librarySectionKey?: string | undefined; - grandparentTitle?: string | undefined; - parentTitle?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - index?: number | undefined; - parentIndex?: number | undefined; - lastViewedAt?: number | undefined; - year?: number | undefined; - thumb?: string | undefined; - art?: string | undefined; - parentThumb?: string | undefined; - grandparentThumb?: string | undefined; - grandparentArt?: string | undefined; - grandparentTheme?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - Media?: Array | undefined; - guids?: Array | undefined; - }; +/** @internal */ +export type GetOnDeckMetadata$Outbound = { + allowSync?: boolean | undefined; + librarySectionID?: number | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + ratingKey?: number | undefined; + key?: string | undefined; + parentRatingKey?: number | undefined; + grandparentRatingKey?: number | undefined; + guid?: string | undefined; + parentGuid?: string | undefined; + grandparentGuid?: string | undefined; + type?: string | undefined; + title?: string | undefined; + grandparentKey?: string | undefined; + parentKey?: string | undefined; + librarySectionKey?: string | undefined; + grandparentTitle?: string | undefined; + parentTitle?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + index?: number | undefined; + parentIndex?: number | undefined; + lastViewedAt?: number | undefined; + year?: number | undefined; + thumb?: string | undefined; + art?: string | undefined; + parentThumb?: string | undefined; + grandparentThumb?: string | undefined; + grandparentArt?: string | undefined; + grandparentTheme?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + Media?: Array | undefined; + Guid?: Array | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - librarySectionID: z.number().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - ratingKey: z.number().optional(), - key: z.string().optional(), - parentRatingKey: z.number().optional(), - grandparentRatingKey: z.number().optional(), - guid: z.string().optional(), - parentGuid: z.string().optional(), - grandparentGuid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - grandparentKey: z.string().optional(), - parentKey: z.string().optional(), - librarySectionKey: z.string().optional(), - grandparentTitle: z.string().optional(), - parentTitle: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - index: z.number().optional(), - parentIndex: z.number().optional(), - lastViewedAt: z.number().optional(), - year: z.number().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - parentThumb: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentArt: z.string().optional(), - grandparentTheme: z.string().optional(), - duration: z.number().optional(), - originallyAvailableAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - addedAt: z.number().optional(), - updatedAt: z.number().optional(), - media: z.array(z.lazy(() => GetOnDeckMedia$.outboundSchema)).optional(), - guids: z.array(z.lazy(() => GetOnDeckGuids$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - }); +/** @internal */ +export const GetOnDeckMetadata$outboundSchema: z.ZodType< + GetOnDeckMetadata$Outbound, + z.ZodTypeDef, + GetOnDeckMetadata +> = z + .object({ + allowSync: z.boolean().optional(), + librarySectionID: z.number().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + ratingKey: z.number().optional(), + key: z.string().optional(), + parentRatingKey: z.number().optional(), + grandparentRatingKey: z.number().optional(), + guid: z.string().optional(), + parentGuid: z.string().optional(), + grandparentGuid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + grandparentKey: z.string().optional(), + parentKey: z.string().optional(), + librarySectionKey: z.string().optional(), + grandparentTitle: z.string().optional(), + parentTitle: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + index: z.number().optional(), + parentIndex: z.number().optional(), + lastViewedAt: z.number().optional(), + year: z.number().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + parentThumb: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentArt: z.string().optional(), + grandparentTheme: z.string().optional(), + duration: z.number().optional(), + originallyAvailableAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + addedAt: z.number().optional(), + updatedAt: z.number().optional(), + media: z.array(z.lazy(() => GetOnDeckMedia$outboundSchema)).optional(), + guids: z.array(z.lazy(() => GetOnDeckGuids$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + guids: "Guid", }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetOnDeckMetadata$ { + /** @deprecated use `GetOnDeckMetadata$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckMetadata$inboundSchema; + /** @deprecated use `GetOnDeckMetadata$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckMetadata$outboundSchema; + /** @deprecated use `GetOnDeckMetadata$Outbound` instead. */ + export type Outbound = GetOnDeckMetadata$Outbound; } /** @internal */ +export const GetOnDeckMediaContainer$inboundSchema: z.ZodType< + GetOnDeckMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().optional(), + mixedParents: z.boolean().optional(), + Metadata: z.array(z.lazy(() => GetOnDeckMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetOnDeckMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + identifier?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + mixedParents?: boolean | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetOnDeckMediaContainer$outboundSchema: z.ZodType< + GetOnDeckMediaContainer$Outbound, + z.ZodTypeDef, + GetOnDeckMediaContainer +> = z + .object({ + size: z.number().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().optional(), + mixedParents: z.boolean().optional(), + metadata: z.array(z.lazy(() => GetOnDeckMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().optional(), - mixedParents: z.boolean().optional(), - Metadata: z.array(z.lazy(() => GetOnDeckMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - identifier?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - mixedParents?: boolean | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().optional(), - mixedParents: z.boolean().optional(), - metadata: z.array(z.lazy(() => GetOnDeckMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetOnDeckMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckMediaContainer$inboundSchema; + /** @deprecated use `GetOnDeckMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckMediaContainer$outboundSchema; + /** @deprecated use `GetOnDeckMediaContainer$Outbound` instead. */ + export type Outbound = GetOnDeckMediaContainer$Outbound; } /** @internal */ +export const GetOnDeckResponseBody$inboundSchema: z.ZodType< + GetOnDeckResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetOnDeckMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetOnDeckResponseBody$Outbound = { + MediaContainer?: GetOnDeckMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetOnDeckResponseBody$outboundSchema: z.ZodType< + GetOnDeckResponseBody$Outbound, + z.ZodTypeDef, + GetOnDeckResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetOnDeckMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetOnDeckResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetOnDeckMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetOnDeckMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetOnDeckMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetOnDeckResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckResponseBody$inboundSchema; + /** @deprecated use `GetOnDeckResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckResponseBody$outboundSchema; + /** @deprecated use `GetOnDeckResponseBody$Outbound` instead. */ + export type Outbound = GetOnDeckResponseBody$Outbound; } /** @internal */ -export namespace GetOnDeckResponse$ { - export const inboundSchema: z.ZodType = z +export const GetOnDeckResponse$inboundSchema: z.ZodType = + z .object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), - object: z.lazy(() => GetOnDeckResponseBody$.inboundSchema).optional(), + object: z.lazy(() => GetOnDeckResponseBody$inboundSchema).optional(), }) .transform((v) => { return remap$(v, { @@ -697,27 +867,45 @@ export namespace GetOnDeckResponse$ { }); }); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetOnDeckResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type GetOnDeckResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetOnDeckResponseBody$Outbound | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetOnDeckResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); +/** @internal */ +export const GetOnDeckResponse$outboundSchema: z.ZodType< + GetOnDeckResponse$Outbound, + z.ZodTypeDef, + GetOnDeckResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetOnDeckResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetOnDeckResponse$ { + /** @deprecated use `GetOnDeckResponse$inboundSchema` instead. */ + export const inboundSchema = GetOnDeckResponse$inboundSchema; + /** @deprecated use `GetOnDeckResponse$outboundSchema` instead. */ + export const outboundSchema = GetOnDeckResponse$outboundSchema; + /** @deprecated use `GetOnDeckResponse$Outbound` instead. */ + export type Outbound = GetOnDeckResponse$Outbound; } diff --git a/src/models/getpinop.ts b/src/models/getpinop.ts index 5d764a88..7d2c4c91 100644 --- a/src/models/getpinop.ts +++ b/src/models/getpinop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -54,9 +54,9 @@ export type GetPinErrors = { }; /** - * X-Plex-Client-Identifier is missing + * Bad Request response when the X-Plex-Client-Identifier is missing */ -export type GetPinPlexResponseBodyData = { +export type GetPinResponseBodyData = { errors?: Array | undefined; /** * Raw HTTP response; suitable for custom response parsing @@ -65,9 +65,9 @@ export type GetPinPlexResponseBodyData = { }; /** - * X-Plex-Client-Identifier is missing + * Bad Request response when the X-Plex-Client-Identifier is missing */ -export class GetPinPlexResponseBody extends Error { +export class GetPinResponseBody extends Error { errors?: Array | undefined; /** * Raw HTTP response; suitable for custom response parsing @@ -75,10 +75,14 @@ export class GetPinPlexResponseBody extends Error { rawResponse?: Response | undefined; /** The original data that was passed to this error instance. */ - data$: GetPinPlexResponseBodyData; + data$: GetPinResponseBodyData; - constructor(err: GetPinPlexResponseBodyData) { - super(""); + constructor(err: GetPinResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -88,55 +92,85 @@ export class GetPinPlexResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - - this.name = "GetPinPlexResponseBody"; + this.name = "GetPinResponseBody"; } } -export type Location = { - code?: string | undefined; +/** + * Geo location data + */ +export type GeoData = { + /** + * The ISO 3166-1 alpha-2 code of the country. + */ + code: string; + /** + * The continent code where the country is located. + */ + continentCode: string; + /** + * The official name of the country. + */ + country: string; + /** + * The name of the city. + */ + city: string; + /** + * Indicates if the country is a member of the European Union. + */ europeanUnionMember?: boolean | undefined; - continentCode?: string | undefined; - country?: string | undefined; - city?: string | undefined; - timeZone?: string | undefined; - postalCode?: string | undefined; + /** + * The time zone of the country. + */ + timeZone: string; + /** + * The postal code of the location. + */ + postalCode: number; + /** + * Indicates if the country has privacy restrictions. + */ inPrivacyRestrictedCountry?: boolean | undefined; - subdivisions?: string | undefined; - coordinates?: string | undefined; + /** + * Indicates if the region has privacy restrictions. + */ + inPrivacyRestrictedRegion?: boolean | undefined; + /** + * The name of the primary administrative subdivision. + */ + subdivisions: string; + /** + * The geographical coordinates (latitude, longitude) of the location. + */ + coordinates: string; }; /** - * The Pin + * Requests a new pin id used in the authentication flow */ -export type GetPinResponseBody = { - /** - * PinID for use with authentication - */ - id?: number | undefined; - code?: string | undefined; - product?: string | undefined; +export type GetPinAuthPinContainer = { + id: number; + code: string; + product: string; trusted?: boolean | undefined; + qr: string; /** - * a link to a QR code hosted on plex.tv - * - * @remarks - * The QR code redirects to the relevant `plex.tv/link` authentication page - * Which then prompts the user for the 4 Digit Link Pin - * + * The X-Client-Identifier used in the request + */ + clientIdentifier: string; + /** + * Geo location data + */ + location: GeoData; + /** + * The number of seconds this pin expires, by default 900 seconds */ - qr?: string | undefined; - clientIdentifier?: string | undefined; - location?: Location | undefined; expiresIn?: number | undefined; - createdAt?: Date | undefined; - expiresAt?: Date | undefined; - authToken?: string | undefined; - newRegistration?: boolean | null | undefined; + createdAt: Date; + expiresAt: Date; + authToken?: any | null | undefined; + newRegistration?: any | null | undefined; }; export type GetPinResponse = { @@ -153,298 +187,420 @@ export type GetPinResponse = { */ rawResponse: Response; /** - * The Pin + * Requests a new pin id used in the authentication flow */ - object?: GetPinResponseBody | undefined; + authPinContainer?: GetPinAuthPinContainer | undefined; }; /** @internal */ +export const GetPinGlobals$inboundSchema: z.ZodType = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + }); + }); + +/** @internal */ +export type GetPinGlobals$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; +}; + +/** @internal */ +export const GetPinGlobals$outboundSchema: z.ZodType< + GetPinGlobals$Outbound, + z.ZodTypeDef, + GetPinGlobals +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPinGlobals$ { - export const inboundSchema: z.ZodType = z - .object({ - "X-Plex-Client-Identifier": z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - "X-Plex-Client-Identifier": "xPlexClientIdentifier", - }); - }); - - export type Outbound = { - "X-Plex-Client-Identifier"?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - xPlexClientIdentifier: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - xPlexClientIdentifier: "X-Plex-Client-Identifier", - }); - }); + /** @deprecated use `GetPinGlobals$inboundSchema` instead. */ + export const inboundSchema = GetPinGlobals$inboundSchema; + /** @deprecated use `GetPinGlobals$outboundSchema` instead. */ + export const outboundSchema = GetPinGlobals$outboundSchema; + /** @deprecated use `GetPinGlobals$Outbound` instead. */ + export type Outbound = GetPinGlobals$Outbound; } /** @internal */ +export const GetPinRequest$inboundSchema: z.ZodType = z + .object({ + strong: z.boolean(), + "X-Plex-Client-Identifier": z.string().optional(), + "X-Plex-Product": z.string(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + "X-Plex-Product": "xPlexProduct", + }); + }); + +/** @internal */ +export type GetPinRequest$Outbound = { + strong: boolean; + "X-Plex-Client-Identifier"?: string | undefined; + "X-Plex-Product": string; +}; + +/** @internal */ +export const GetPinRequest$outboundSchema: z.ZodType< + GetPinRequest$Outbound, + z.ZodTypeDef, + GetPinRequest +> = z + .object({ + strong: z.boolean().default(false), + xPlexClientIdentifier: z.string().optional(), + xPlexProduct: z.string(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + xPlexProduct: "X-Plex-Product", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPinRequest$ { - export const inboundSchema: z.ZodType = z - .object({ - strong: z.boolean().default(false), - "X-Plex-Client-Identifier": z.string().optional(), - "X-Plex-Product": z.string(), - }) - .transform((v) => { - return remap$(v, { - "X-Plex-Client-Identifier": "xPlexClientIdentifier", - "X-Plex-Product": "xPlexProduct", - }); - }); - - export type Outbound = { - strong: boolean; - "X-Plex-Client-Identifier"?: string | undefined; - "X-Plex-Product": string; - }; - - export const outboundSchema: z.ZodType = z - .object({ - strong: z.boolean().default(false), - xPlexClientIdentifier: z.string().optional(), - xPlexProduct: z.string(), - }) - .transform((v) => { - return remap$(v, { - xPlexClientIdentifier: "X-Plex-Client-Identifier", - xPlexProduct: "X-Plex-Product", - }); - }); + /** @deprecated use `GetPinRequest$inboundSchema` instead. */ + export const inboundSchema = GetPinRequest$inboundSchema; + /** @deprecated use `GetPinRequest$outboundSchema` instead. */ + export const outboundSchema = GetPinRequest$outboundSchema; + /** @deprecated use `GetPinRequest$Outbound` instead. */ + export type Outbound = GetPinRequest$Outbound; } /** @internal */ +export const GetPinErrors$inboundSchema: z.ZodType = z.object({ + code: z.number().int().optional(), + message: z.string().optional(), + status: z.number().int().optional(), +}); + +/** @internal */ +export type GetPinErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetPinErrors$outboundSchema: z.ZodType< + GetPinErrors$Outbound, + z.ZodTypeDef, + GetPinErrors +> = z.object({ + code: z.number().int().optional(), + message: z.string().optional(), + status: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPinErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `GetPinErrors$inboundSchema` instead. */ + export const inboundSchema = GetPinErrors$inboundSchema; + /** @deprecated use `GetPinErrors$outboundSchema` instead. */ + export const outboundSchema = GetPinErrors$outboundSchema; + /** @deprecated use `GetPinErrors$Outbound` instead. */ + export type Outbound = GetPinErrors$Outbound; +} + +/** @internal */ +export const GetPinResponseBody$inboundSchema: z.ZodType< + GetPinResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetPinErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetPinResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} +/** @internal */ +export type GetPinResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetPinPlexResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetPinErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); +export const GetPinResponseBody$outboundSchema: z.ZodType< + GetPinResponseBody$Outbound, + z.ZodTypeDef, + GetPinResponseBody +> = z + .instanceof(GetPinResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetPinErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); - return new GetPinPlexResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetPinPlexResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetPinErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace Location$ { - export const inboundSchema: z.ZodType = z - .object({ - code: z.string().optional(), - european_union_member: z.boolean().optional(), - continent_code: z.string().optional(), - country: z.string().optional(), - city: z.string().optional(), - time_zone: z.string().optional(), - postal_code: z.string().optional(), - in_privacy_restricted_country: z.boolean().optional(), - subdivisions: z.string().optional(), - coordinates: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - european_union_member: "europeanUnionMember", - continent_code: "continentCode", - time_zone: "timeZone", - postal_code: "postalCode", - in_privacy_restricted_country: "inPrivacyRestrictedCountry", - }); - }); - - export type Outbound = { - code?: string | undefined; - european_union_member?: boolean | undefined; - continent_code?: string | undefined; - country?: string | undefined; - city?: string | undefined; - time_zone?: string | undefined; - postal_code?: string | undefined; - in_privacy_restricted_country?: boolean | undefined; - subdivisions?: string | undefined; - coordinates?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - code: z.string().optional(), - europeanUnionMember: z.boolean().optional(), - continentCode: z.string().optional(), - country: z.string().optional(), - city: z.string().optional(), - timeZone: z.string().optional(), - postalCode: z.string().optional(), - inPrivacyRestrictedCountry: z.boolean().optional(), - subdivisions: z.string().optional(), - coordinates: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - europeanUnionMember: "european_union_member", - continentCode: "continent_code", - timeZone: "time_zone", - postalCode: "postal_code", - inPrivacyRestrictedCountry: "in_privacy_restricted_country", - }); - }); -} - -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPinResponseBody$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - code: z.string().optional(), - product: z.string().optional(), - trusted: z.boolean().optional(), - qr: z.string().optional(), - clientIdentifier: z.string().optional(), - location: z.lazy(() => Location$.inboundSchema).optional(), - expiresIn: z.number().optional(), - createdAt: z - .string() - .datetime({ offset: true }) - .transform((v) => new Date(v)) - .optional(), - expiresAt: z - .string() - .datetime({ offset: true }) - .transform((v) => new Date(v)) - .optional(), - authToken: z.string().optional(), - newRegistration: z.nullable(z.boolean()).optional(), - }); - - export type Outbound = { - id?: number | undefined; - code?: string | undefined; - product?: string | undefined; - trusted?: boolean | undefined; - qr?: string | undefined; - clientIdentifier?: string | undefined; - location?: Location$.Outbound | undefined; - expiresIn?: number | undefined; - createdAt?: string | undefined; - expiresAt?: string | undefined; - authToken?: string | undefined; - newRegistration?: boolean | null | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - code: z.string().optional(), - product: z.string().optional(), - trusted: z.boolean().optional(), - qr: z.string().optional(), - clientIdentifier: z.string().optional(), - location: z.lazy(() => Location$.outboundSchema).optional(), - expiresIn: z.number().optional(), - createdAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - expiresAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - authToken: z.string().optional(), - newRegistration: z.nullable(z.boolean()).optional(), - }); + /** @deprecated use `GetPinResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPinResponseBody$inboundSchema; + /** @deprecated use `GetPinResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPinResponseBody$outboundSchema; + /** @deprecated use `GetPinResponseBody$Outbound` instead. */ + export type Outbound = GetPinResponseBody$Outbound; } /** @internal */ -export namespace GetPinResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetPinResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); +export const GeoData$inboundSchema: z.ZodType = z + .object({ + code: z.string(), + continent_code: z.string(), + country: z.string(), + city: z.string(), + european_union_member: z.boolean(), + time_zone: z.string(), + postal_code: z.number().int(), + in_privacy_restricted_country: z.boolean(), + in_privacy_restricted_region: z.boolean(), + subdivisions: z.string(), + coordinates: z.string(), + }) + .transform((v) => { + return remap$(v, { + continent_code: "continentCode", + european_union_member: "europeanUnionMember", + time_zone: "timeZone", + postal_code: "postalCode", + in_privacy_restricted_country: "inPrivacyRestrictedCountry", + in_privacy_restricted_region: "inPrivacyRestrictedRegion", }); + }); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetPinResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type GeoData$Outbound = { + code: string; + continent_code: string; + country: string; + city: string; + european_union_member: boolean; + time_zone: string; + postal_code: number; + in_privacy_restricted_country: boolean; + in_privacy_restricted_region: boolean; + subdivisions: string; + coordinates: string; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetPinResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); +/** @internal */ +export const GeoData$outboundSchema: z.ZodType = z + .object({ + code: z.string(), + continentCode: z.string(), + country: z.string(), + city: z.string(), + europeanUnionMember: z.boolean().default(false), + timeZone: z.string(), + postalCode: z.number().int(), + inPrivacyRestrictedCountry: z.boolean().default(false), + inPrivacyRestrictedRegion: z.boolean().default(false), + subdivisions: z.string(), + coordinates: z.string(), + }) + .transform((v) => { + return remap$(v, { + continentCode: "continent_code", + europeanUnionMember: "european_union_member", + timeZone: "time_zone", + postalCode: "postal_code", + inPrivacyRestrictedCountry: "in_privacy_restricted_country", + inPrivacyRestrictedRegion: "in_privacy_restricted_region", }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GeoData$ { + /** @deprecated use `GeoData$inboundSchema` instead. */ + export const inboundSchema = GeoData$inboundSchema; + /** @deprecated use `GeoData$outboundSchema` instead. */ + export const outboundSchema = GeoData$outboundSchema; + /** @deprecated use `GeoData$Outbound` instead. */ + export type Outbound = GeoData$Outbound; +} + +/** @internal */ +export const GetPinAuthPinContainer$inboundSchema: z.ZodType< + GetPinAuthPinContainer, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int(), + code: z.string(), + product: z.string(), + trusted: z.boolean(), + qr: z.string(), + clientIdentifier: z.string(), + location: z.lazy(() => GeoData$inboundSchema), + expiresIn: z.number().int().default(900), + createdAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)), + expiresAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)), + authToken: z.nullable(z.any()).optional(), + newRegistration: z.nullable(z.any()).optional(), +}); + +/** @internal */ +export type GetPinAuthPinContainer$Outbound = { + id: number; + code: string; + product: string; + trusted: boolean; + qr: string; + clientIdentifier: string; + location: GeoData$Outbound; + expiresIn: number; + createdAt: string; + expiresAt: string; + authToken?: any | null | undefined; + newRegistration?: any | null | undefined; +}; + +/** @internal */ +export const GetPinAuthPinContainer$outboundSchema: z.ZodType< + GetPinAuthPinContainer$Outbound, + z.ZodTypeDef, + GetPinAuthPinContainer +> = z.object({ + id: z.number().int(), + code: z.string(), + product: z.string(), + trusted: z.boolean().default(false), + qr: z.string(), + clientIdentifier: z.string(), + location: z.lazy(() => GeoData$outboundSchema), + expiresIn: z.number().int().default(900), + createdAt: z.date().transform((v) => v.toISOString()), + expiresAt: z.date().transform((v) => v.toISOString()), + authToken: z.nullable(z.any()).optional(), + newRegistration: z.nullable(z.any()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPinAuthPinContainer$ { + /** @deprecated use `GetPinAuthPinContainer$inboundSchema` instead. */ + export const inboundSchema = GetPinAuthPinContainer$inboundSchema; + /** @deprecated use `GetPinAuthPinContainer$outboundSchema` instead. */ + export const outboundSchema = GetPinAuthPinContainer$outboundSchema; + /** @deprecated use `GetPinAuthPinContainer$Outbound` instead. */ + export type Outbound = GetPinAuthPinContainer$Outbound; +} + +/** @internal */ +export const GetPinResponse$inboundSchema: z.ZodType = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + AuthPinContainer: z.lazy(() => GetPinAuthPinContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + AuthPinContainer: "authPinContainer", + }); + }); + +/** @internal */ +export type GetPinResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + AuthPinContainer?: GetPinAuthPinContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetPinResponse$outboundSchema: z.ZodType< + GetPinResponse$Outbound, + z.ZodTypeDef, + GetPinResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + authPinContainer: z.lazy(() => GetPinAuthPinContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + authPinContainer: "AuthPinContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPinResponse$ { + /** @deprecated use `GetPinResponse$inboundSchema` instead. */ + export const inboundSchema = GetPinResponse$inboundSchema; + /** @deprecated use `GetPinResponse$outboundSchema` instead. */ + export const outboundSchema = GetPinResponse$outboundSchema; + /** @deprecated use `GetPinResponse$Outbound` instead. */ + export type Outbound = GetPinResponse$Outbound; } diff --git a/src/models/getplaylistcontentsop.ts b/src/models/getplaylistcontentsop.ts index fea02d33..db0ba36d 100644 --- a/src/models/getplaylistcontentsop.ts +++ b/src/models/getplaylistcontentsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -48,7 +48,11 @@ export class GetPlaylistContentsPlaylistsResponseBody extends Error { data$: GetPlaylistContentsPlaylistsResponseBodyData; constructor(err: GetPlaylistContentsPlaylistsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -58,11 +62,6 @@ export class GetPlaylistContentsPlaylistsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetPlaylistContentsPlaylistsResponseBody"; } } @@ -194,573 +193,824 @@ export type GetPlaylistContentsResponse = { }; /** @internal */ +export const GetPlaylistContentsRequest$inboundSchema: z.ZodType< + GetPlaylistContentsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistID: z.number(), + type: z.number(), +}); + +/** @internal */ +export type GetPlaylistContentsRequest$Outbound = { + playlistID: number; + type: number; +}; + +/** @internal */ +export const GetPlaylistContentsRequest$outboundSchema: z.ZodType< + GetPlaylistContentsRequest$Outbound, + z.ZodTypeDef, + GetPlaylistContentsRequest +> = z.object({ + playlistID: z.number(), + type: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistContentsRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - type: z.number(), - }); - - export type Outbound = { - playlistID: number; - type: number; - }; - - export const outboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - type: z.number(), - }); + /** @deprecated use `GetPlaylistContentsRequest$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsRequest$inboundSchema; + /** @deprecated use `GetPlaylistContentsRequest$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsRequest$outboundSchema; + /** @deprecated use `GetPlaylistContentsRequest$Outbound` instead. */ + export type Outbound = GetPlaylistContentsRequest$Outbound; } /** @internal */ +export const GetPlaylistContentsErrors$inboundSchema: z.ZodType< + GetPlaylistContentsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetPlaylistContentsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsErrors$outboundSchema: z.ZodType< + GetPlaylistContentsErrors$Outbound, + z.ZodTypeDef, + GetPlaylistContentsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistContentsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetPlaylistContentsErrors$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsErrors$inboundSchema; + /** @deprecated use `GetPlaylistContentsErrors$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsErrors$outboundSchema; + /** @deprecated use `GetPlaylistContentsErrors$Outbound` instead. */ + export type Outbound = GetPlaylistContentsErrors$Outbound; } /** @internal */ -export namespace GetPlaylistContentsPlaylistsResponseBody$ { - export const inboundSchema: z.ZodType< - GetPlaylistContentsPlaylistsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetPlaylistContentsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetPlaylistContentsPlaylistsResponseBody(remapped); +export const GetPlaylistContentsPlaylistsResponseBody$inboundSchema: z.ZodType< + GetPlaylistContentsPlaylistsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetPlaylistContentsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetPlaylistContentsPlaylistsResponseBody - > = z - .instanceof(GetPlaylistContentsPlaylistsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetPlaylistContentsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new GetPlaylistContentsPlaylistsResponseBody(remapped); + }); /** @internal */ -export namespace GetPlaylistContentsPart$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - audioProfile?: string | undefined; - container?: string | undefined; - has64bitOffsets?: boolean | undefined; - optimizedForStreaming?: boolean | undefined; - videoProfile?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - size: z.number().int().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - }); -} +export type GetPlaylistContentsPlaylistsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetPlaylistContentsMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().int().optional(), - audioProfile: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => GetPlaylistContentsPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: string | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - optimizedForStreaming?: number | undefined; - audioProfile?: string | undefined; - has64bitOffsets?: boolean | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().int().optional(), - duration: z.number().int().optional(), - bitrate: z.number().int().optional(), - width: z.number().int().optional(), - height: z.number().int().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.string().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().int().optional(), - audioProfile: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => GetPlaylistContentsPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); -} - -/** @internal */ -export namespace GetPlaylistContentsGenre$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetPlaylistContentsCountry$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetPlaylistContentsDirector$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetPlaylistContentsWriter$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetPlaylistContentsRole$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetPlaylistContentsMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - titleSort: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - hasPremiumExtras: z.string().optional(), - hasPremiumPrimaryExtra: z.string().optional(), - ratingImage: z.string().optional(), - Media: z.array(z.lazy(() => GetPlaylistContentsMedia$.inboundSchema)).optional(), - Genre: z.array(z.lazy(() => GetPlaylistContentsGenre$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => GetPlaylistContentsCountry$.inboundSchema)).optional(), - Director: z.array(z.lazy(() => GetPlaylistContentsDirector$.inboundSchema)).optional(), - Writer: z.array(z.lazy(() => GetPlaylistContentsWriter$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => GetPlaylistContentsRole$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - Genre: "genre", - Country: "country", - Director: "director", - Writer: "writer", - Role: "role", - }); - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - titleSort?: string | undefined; - librarySectionTitle?: string | undefined; - librarySectionID?: number | undefined; - librarySectionKey?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - rating?: number | undefined; - audienceRating?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - audienceRatingImage?: string | undefined; - hasPremiumExtras?: string | undefined; - hasPremiumPrimaryExtra?: string | undefined; - ratingImage?: string | undefined; - Media?: Array | undefined; - Genre?: Array | undefined; - Country?: Array | undefined; - Director?: Array | undefined; - Writer?: Array | undefined; - Role?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - titleSort: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - hasPremiumExtras: z.string().optional(), - hasPremiumPrimaryExtra: z.string().optional(), - ratingImage: z.string().optional(), - media: z.array(z.lazy(() => GetPlaylistContentsMedia$.outboundSchema)).optional(), - genre: z.array(z.lazy(() => GetPlaylistContentsGenre$.outboundSchema)).optional(), - country: z.array(z.lazy(() => GetPlaylistContentsCountry$.outboundSchema)).optional(), - director: z.array(z.lazy(() => GetPlaylistContentsDirector$.outboundSchema)).optional(), - writer: z.array(z.lazy(() => GetPlaylistContentsWriter$.outboundSchema)).optional(), - role: z.array(z.lazy(() => GetPlaylistContentsRole$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - genre: "Genre", - country: "Country", - director: "Director", - writer: "Writer", - role: "Role", - }); - }); -} - -/** @internal */ -export namespace GetPlaylistContentsMediaContainer$ { - export const inboundSchema: z.ZodType< - GetPlaylistContentsMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - composite: z.string().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - playlistType: z.string().optional(), - ratingKey: z.string().optional(), - smart: z.boolean().optional(), - title: z.string().optional(), - Metadata: z.array(z.lazy(() => GetPlaylistContentsMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - composite?: string | undefined; - duration?: number | undefined; - leafCount?: number | undefined; - playlistType?: string | undefined; - ratingKey?: string | undefined; - smart?: boolean | undefined; - title?: string | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetPlaylistContentsMediaContainer - > = z - .object({ - size: z.number().int().optional(), - composite: z.string().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - playlistType: z.string().optional(), - ratingKey: z.string().optional(), - smart: z.boolean().optional(), - title: z.string().optional(), - metadata: z.array(z.lazy(() => GetPlaylistContentsMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); -} - -/** @internal */ -export namespace GetPlaylistContentsResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetPlaylistContentsPlaylistsResponseBody$outboundSchema: z.ZodType< + GetPlaylistContentsPlaylistsResponseBody$Outbound, + z.ZodTypeDef, + GetPlaylistContentsPlaylistsResponseBody +> = z + .instanceof(GetPlaylistContentsPlaylistsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => GetPlaylistContentsMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => GetPlaylistContentsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: GetPlaylistContentsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetPlaylistContentsResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetPlaylistContentsMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsPlaylistsResponseBody$ { + /** @deprecated use `GetPlaylistContentsPlaylistsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsPlaylistsResponseBody$inboundSchema; + /** @deprecated use `GetPlaylistContentsPlaylistsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsPlaylistsResponseBody$outboundSchema; + /** @deprecated use `GetPlaylistContentsPlaylistsResponseBody$Outbound` instead. */ + export type Outbound = GetPlaylistContentsPlaylistsResponseBody$Outbound; } /** @internal */ -export namespace GetPlaylistContentsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetPlaylistContentsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const GetPlaylistContentsPart$inboundSchema: z.ZodType< + GetPlaylistContentsPart, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetPlaylistContentsResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type GetPlaylistContentsPart$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + audioProfile?: string | undefined; + container?: string | undefined; + has64bitOffsets?: boolean | undefined; + optimizedForStreaming?: boolean | undefined; + videoProfile?: string | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetPlaylistContentsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const GetPlaylistContentsPart$outboundSchema: z.ZodType< + GetPlaylistContentsPart$Outbound, + z.ZodTypeDef, + GetPlaylistContentsPart +> = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + size: z.number().int().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsPart$ { + /** @deprecated use `GetPlaylistContentsPart$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsPart$inboundSchema; + /** @deprecated use `GetPlaylistContentsPart$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsPart$outboundSchema; + /** @deprecated use `GetPlaylistContentsPart$Outbound` instead. */ + export type Outbound = GetPlaylistContentsPart$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsMedia$inboundSchema: z.ZodType< + GetPlaylistContentsMedia, + z.ZodTypeDef, + unknown +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().int().optional(), + audioProfile: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => GetPlaylistContentsPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetPlaylistContentsMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: string | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + optimizedForStreaming?: number | undefined; + audioProfile?: string | undefined; + has64bitOffsets?: boolean | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsMedia$outboundSchema: z.ZodType< + GetPlaylistContentsMedia$Outbound, + z.ZodTypeDef, + GetPlaylistContentsMedia +> = z + .object({ + id: z.number().int().optional(), + duration: z.number().int().optional(), + bitrate: z.number().int().optional(), + width: z.number().int().optional(), + height: z.number().int().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.string().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().int().optional(), + audioProfile: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => GetPlaylistContentsPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsMedia$ { + /** @deprecated use `GetPlaylistContentsMedia$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsMedia$inboundSchema; + /** @deprecated use `GetPlaylistContentsMedia$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsMedia$outboundSchema; + /** @deprecated use `GetPlaylistContentsMedia$Outbound` instead. */ + export type Outbound = GetPlaylistContentsMedia$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsGenre$inboundSchema: z.ZodType< + GetPlaylistContentsGenre, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetPlaylistContentsGenre$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsGenre$outboundSchema: z.ZodType< + GetPlaylistContentsGenre$Outbound, + z.ZodTypeDef, + GetPlaylistContentsGenre +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsGenre$ { + /** @deprecated use `GetPlaylistContentsGenre$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsGenre$inboundSchema; + /** @deprecated use `GetPlaylistContentsGenre$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsGenre$outboundSchema; + /** @deprecated use `GetPlaylistContentsGenre$Outbound` instead. */ + export type Outbound = GetPlaylistContentsGenre$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsCountry$inboundSchema: z.ZodType< + GetPlaylistContentsCountry, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetPlaylistContentsCountry$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsCountry$outboundSchema: z.ZodType< + GetPlaylistContentsCountry$Outbound, + z.ZodTypeDef, + GetPlaylistContentsCountry +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsCountry$ { + /** @deprecated use `GetPlaylistContentsCountry$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsCountry$inboundSchema; + /** @deprecated use `GetPlaylistContentsCountry$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsCountry$outboundSchema; + /** @deprecated use `GetPlaylistContentsCountry$Outbound` instead. */ + export type Outbound = GetPlaylistContentsCountry$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsDirector$inboundSchema: z.ZodType< + GetPlaylistContentsDirector, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetPlaylistContentsDirector$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsDirector$outboundSchema: z.ZodType< + GetPlaylistContentsDirector$Outbound, + z.ZodTypeDef, + GetPlaylistContentsDirector +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsDirector$ { + /** @deprecated use `GetPlaylistContentsDirector$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsDirector$inboundSchema; + /** @deprecated use `GetPlaylistContentsDirector$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsDirector$outboundSchema; + /** @deprecated use `GetPlaylistContentsDirector$Outbound` instead. */ + export type Outbound = GetPlaylistContentsDirector$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsWriter$inboundSchema: z.ZodType< + GetPlaylistContentsWriter, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetPlaylistContentsWriter$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsWriter$outboundSchema: z.ZodType< + GetPlaylistContentsWriter$Outbound, + z.ZodTypeDef, + GetPlaylistContentsWriter +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsWriter$ { + /** @deprecated use `GetPlaylistContentsWriter$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsWriter$inboundSchema; + /** @deprecated use `GetPlaylistContentsWriter$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsWriter$outboundSchema; + /** @deprecated use `GetPlaylistContentsWriter$Outbound` instead. */ + export type Outbound = GetPlaylistContentsWriter$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsRole$inboundSchema: z.ZodType< + GetPlaylistContentsRole, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetPlaylistContentsRole$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsRole$outboundSchema: z.ZodType< + GetPlaylistContentsRole$Outbound, + z.ZodTypeDef, + GetPlaylistContentsRole +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsRole$ { + /** @deprecated use `GetPlaylistContentsRole$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsRole$inboundSchema; + /** @deprecated use `GetPlaylistContentsRole$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsRole$outboundSchema; + /** @deprecated use `GetPlaylistContentsRole$Outbound` instead. */ + export type Outbound = GetPlaylistContentsRole$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsMetadata$inboundSchema: z.ZodType< + GetPlaylistContentsMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + titleSort: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + hasPremiumExtras: z.string().optional(), + hasPremiumPrimaryExtra: z.string().optional(), + ratingImage: z.string().optional(), + Media: z.array(z.lazy(() => GetPlaylistContentsMedia$inboundSchema)).optional(), + Genre: z.array(z.lazy(() => GetPlaylistContentsGenre$inboundSchema)).optional(), + Country: z.array(z.lazy(() => GetPlaylistContentsCountry$inboundSchema)).optional(), + Director: z.array(z.lazy(() => GetPlaylistContentsDirector$inboundSchema)).optional(), + Writer: z.array(z.lazy(() => GetPlaylistContentsWriter$inboundSchema)).optional(), + Role: z.array(z.lazy(() => GetPlaylistContentsRole$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + Genre: "genre", + Country: "country", + Director: "director", + Writer: "writer", + Role: "role", + }); + }); + +/** @internal */ +export type GetPlaylistContentsMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + titleSort?: string | undefined; + librarySectionTitle?: string | undefined; + librarySectionID?: number | undefined; + librarySectionKey?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + rating?: number | undefined; + audienceRating?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + audienceRatingImage?: string | undefined; + hasPremiumExtras?: string | undefined; + hasPremiumPrimaryExtra?: string | undefined; + ratingImage?: string | undefined; + Media?: Array | undefined; + Genre?: Array | undefined; + Country?: Array | undefined; + Director?: Array | undefined; + Writer?: Array | undefined; + Role?: Array | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsMetadata$outboundSchema: z.ZodType< + GetPlaylistContentsMetadata$Outbound, + z.ZodTypeDef, + GetPlaylistContentsMetadata +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + titleSort: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + hasPremiumExtras: z.string().optional(), + hasPremiumPrimaryExtra: z.string().optional(), + ratingImage: z.string().optional(), + media: z.array(z.lazy(() => GetPlaylistContentsMedia$outboundSchema)).optional(), + genre: z.array(z.lazy(() => GetPlaylistContentsGenre$outboundSchema)).optional(), + country: z.array(z.lazy(() => GetPlaylistContentsCountry$outboundSchema)).optional(), + director: z.array(z.lazy(() => GetPlaylistContentsDirector$outboundSchema)).optional(), + writer: z.array(z.lazy(() => GetPlaylistContentsWriter$outboundSchema)).optional(), + role: z.array(z.lazy(() => GetPlaylistContentsRole$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + genre: "Genre", + country: "Country", + director: "Director", + writer: "Writer", + role: "Role", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsMetadata$ { + /** @deprecated use `GetPlaylistContentsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsMetadata$inboundSchema; + /** @deprecated use `GetPlaylistContentsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsMetadata$outboundSchema; + /** @deprecated use `GetPlaylistContentsMetadata$Outbound` instead. */ + export type Outbound = GetPlaylistContentsMetadata$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsMediaContainer$inboundSchema: z.ZodType< + GetPlaylistContentsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + composite: z.string().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + playlistType: z.string().optional(), + ratingKey: z.string().optional(), + smart: z.boolean().optional(), + title: z.string().optional(), + Metadata: z.array(z.lazy(() => GetPlaylistContentsMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetPlaylistContentsMediaContainer$Outbound = { + size?: number | undefined; + composite?: string | undefined; + duration?: number | undefined; + leafCount?: number | undefined; + playlistType?: string | undefined; + ratingKey?: string | undefined; + smart?: boolean | undefined; + title?: string | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsMediaContainer$outboundSchema: z.ZodType< + GetPlaylistContentsMediaContainer$Outbound, + z.ZodTypeDef, + GetPlaylistContentsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + composite: z.string().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + playlistType: z.string().optional(), + ratingKey: z.string().optional(), + smart: z.boolean().optional(), + title: z.string().optional(), + metadata: z.array(z.lazy(() => GetPlaylistContentsMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsMediaContainer$ { + /** @deprecated use `GetPlaylistContentsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsMediaContainer$inboundSchema; + /** @deprecated use `GetPlaylistContentsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsMediaContainer$outboundSchema; + /** @deprecated use `GetPlaylistContentsMediaContainer$Outbound` instead. */ + export type Outbound = GetPlaylistContentsMediaContainer$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsResponseBody$inboundSchema: z.ZodType< + GetPlaylistContentsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetPlaylistContentsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetPlaylistContentsResponseBody$Outbound = { + MediaContainer?: GetPlaylistContentsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsResponseBody$outboundSchema: z.ZodType< + GetPlaylistContentsResponseBody$Outbound, + z.ZodTypeDef, + GetPlaylistContentsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetPlaylistContentsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsResponseBody$ { + /** @deprecated use `GetPlaylistContentsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsResponseBody$inboundSchema; + /** @deprecated use `GetPlaylistContentsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsResponseBody$outboundSchema; + /** @deprecated use `GetPlaylistContentsResponseBody$Outbound` instead. */ + export type Outbound = GetPlaylistContentsResponseBody$Outbound; +} + +/** @internal */ +export const GetPlaylistContentsResponse$inboundSchema: z.ZodType< + GetPlaylistContentsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetPlaylistContentsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetPlaylistContentsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetPlaylistContentsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetPlaylistContentsResponse$outboundSchema: z.ZodType< + GetPlaylistContentsResponse$Outbound, + z.ZodTypeDef, + GetPlaylistContentsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetPlaylistContentsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistContentsResponse$ { + /** @deprecated use `GetPlaylistContentsResponse$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistContentsResponse$inboundSchema; + /** @deprecated use `GetPlaylistContentsResponse$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistContentsResponse$outboundSchema; + /** @deprecated use `GetPlaylistContentsResponse$Outbound` instead. */ + export type Outbound = GetPlaylistContentsResponse$Outbound; } diff --git a/src/models/getplaylistop.ts b/src/models/getplaylistop.ts index b34ed10a..64e015d7 100644 --- a/src/models/getplaylistop.ts +++ b/src/models/getplaylistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class GetPlaylistPlaylistsResponseBody extends Error { data$: GetPlaylistPlaylistsResponseBodyData; constructor(err: GetPlaylistPlaylistsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class GetPlaylistPlaylistsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetPlaylistPlaylistsResponseBody"; } } @@ -112,240 +111,379 @@ export type GetPlaylistResponse = { }; /** @internal */ +export const GetPlaylistRequest$inboundSchema: z.ZodType< + GetPlaylistRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistID: z.number(), +}); + +/** @internal */ +export type GetPlaylistRequest$Outbound = { + playlistID: number; +}; + +/** @internal */ +export const GetPlaylistRequest$outboundSchema: z.ZodType< + GetPlaylistRequest$Outbound, + z.ZodTypeDef, + GetPlaylistRequest +> = z.object({ + playlistID: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistRequest$ { - export const inboundSchema: z.ZodType = z.object({ - playlistID: z.number(), - }); - - export type Outbound = { - playlistID: number; - }; - - export const outboundSchema: z.ZodType = z.object({ - playlistID: z.number(), - }); + /** @deprecated use `GetPlaylistRequest$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistRequest$inboundSchema; + /** @deprecated use `GetPlaylistRequest$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistRequest$outboundSchema; + /** @deprecated use `GetPlaylistRequest$Outbound` instead. */ + export type Outbound = GetPlaylistRequest$Outbound; } /** @internal */ +export const GetPlaylistErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetPlaylistErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetPlaylistErrors$outboundSchema: z.ZodType< + GetPlaylistErrors$Outbound, + z.ZodTypeDef, + GetPlaylistErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetPlaylistErrors$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistErrors$inboundSchema; + /** @deprecated use `GetPlaylistErrors$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistErrors$outboundSchema; + /** @deprecated use `GetPlaylistErrors$Outbound` instead. */ + export type Outbound = GetPlaylistErrors$Outbound; } /** @internal */ -export namespace GetPlaylistPlaylistsResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetPlaylistPlaylistsResponseBody$inboundSchema: z.ZodType< + GetPlaylistPlaylistsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetPlaylistErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetPlaylistPlaylistsResponseBody(remapped); + }); + +/** @internal */ +export type GetPlaylistPlaylistsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetPlaylistPlaylistsResponseBody$outboundSchema: z.ZodType< + GetPlaylistPlaylistsResponseBody$Outbound, + z.ZodTypeDef, + GetPlaylistPlaylistsResponseBody +> = z + .instanceof(GetPlaylistPlaylistsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => GetPlaylistErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => GetPlaylistErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new GetPlaylistPlaylistsResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetPlaylistPlaylistsResponseBody - > = z - .instanceof(GetPlaylistPlaylistsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetPlaylistErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistPlaylistsResponseBody$ { + /** @deprecated use `GetPlaylistPlaylistsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistPlaylistsResponseBody$inboundSchema; + /** @deprecated use `GetPlaylistPlaylistsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistPlaylistsResponseBody$outboundSchema; + /** @deprecated use `GetPlaylistPlaylistsResponseBody$Outbound` instead. */ + export type Outbound = GetPlaylistPlaylistsResponseBody$Outbound; } /** @internal */ +export const GetPlaylistMetadata$inboundSchema: z.ZodType< + GetPlaylistMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + content: z.string().optional(), + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + icon: z.string().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** @internal */ +export type GetPlaylistMetadata$Outbound = { + content?: string | undefined; + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + type?: string | undefined; + title?: string | undefined; + summary?: string | undefined; + smart?: boolean | undefined; + playlistType?: string | undefined; + composite?: string | undefined; + icon?: string | undefined; + duration?: number | undefined; + leafCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; +}; + +/** @internal */ +export const GetPlaylistMetadata$outboundSchema: z.ZodType< + GetPlaylistMetadata$Outbound, + z.ZodTypeDef, + GetPlaylistMetadata +> = z.object({ + content: z.string().optional(), + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + icon: z.string().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistMetadata$ { - export const inboundSchema: z.ZodType = z.object({ - content: z.string().optional(), - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - icon: z.string().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - }); - - export type Outbound = { - content?: string | undefined; - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - type?: string | undefined; - title?: string | undefined; - summary?: string | undefined; - smart?: boolean | undefined; - playlistType?: string | undefined; - composite?: string | undefined; - icon?: string | undefined; - duration?: number | undefined; - leafCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - content: z.string().optional(), - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - icon: z.string().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - }); + /** @deprecated use `GetPlaylistMetadata$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistMetadata$inboundSchema; + /** @deprecated use `GetPlaylistMetadata$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistMetadata$outboundSchema; + /** @deprecated use `GetPlaylistMetadata$Outbound` instead. */ + export type Outbound = GetPlaylistMetadata$Outbound; } /** @internal */ +export const GetPlaylistMediaContainer$inboundSchema: z.ZodType< + GetPlaylistMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Metadata: z.array(z.lazy(() => GetPlaylistMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetPlaylistMediaContainer$Outbound = { + size?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetPlaylistMediaContainer$outboundSchema: z.ZodType< + GetPlaylistMediaContainer$Outbound, + z.ZodTypeDef, + GetPlaylistMediaContainer +> = z + .object({ + size: z.number().int().optional(), + metadata: z.array(z.lazy(() => GetPlaylistMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - Metadata: z.array(z.lazy(() => GetPlaylistMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - metadata: z.array(z.lazy(() => GetPlaylistMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetPlaylistMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistMediaContainer$inboundSchema; + /** @deprecated use `GetPlaylistMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistMediaContainer$outboundSchema; + /** @deprecated use `GetPlaylistMediaContainer$Outbound` instead. */ + export type Outbound = GetPlaylistMediaContainer$Outbound; } /** @internal */ +export const GetPlaylistResponseBody$inboundSchema: z.ZodType< + GetPlaylistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetPlaylistMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetPlaylistResponseBody$Outbound = { + MediaContainer?: GetPlaylistMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetPlaylistResponseBody$outboundSchema: z.ZodType< + GetPlaylistResponseBody$Outbound, + z.ZodTypeDef, + GetPlaylistResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetPlaylistMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetPlaylistMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetPlaylistMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetPlaylistMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetPlaylistResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistResponseBody$inboundSchema; + /** @deprecated use `GetPlaylistResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistResponseBody$outboundSchema; + /** @deprecated use `GetPlaylistResponseBody$Outbound` instead. */ + export type Outbound = GetPlaylistResponseBody$Outbound; } /** @internal */ +export const GetPlaylistResponse$inboundSchema: z.ZodType< + GetPlaylistResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetPlaylistResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetPlaylistResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetPlaylistResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetPlaylistResponse$outboundSchema: z.ZodType< + GetPlaylistResponse$Outbound, + z.ZodTypeDef, + GetPlaylistResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetPlaylistResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetPlaylistResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetPlaylistResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetPlaylistResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetPlaylistResponse$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistResponse$inboundSchema; + /** @deprecated use `GetPlaylistResponse$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistResponse$outboundSchema; + /** @deprecated use `GetPlaylistResponse$Outbound` instead. */ + export type Outbound = GetPlaylistResponse$Outbound; } diff --git a/src/models/getplaylistsop.ts b/src/models/getplaylistsop.ts index 20d4e28f..6e61e910 100644 --- a/src/models/getplaylistsop.ts +++ b/src/models/getplaylistsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -64,7 +64,11 @@ export class GetPlaylistsPlaylistsResponseBody extends Error { data$: GetPlaylistsPlaylistsResponseBodyData; constructor(err: GetPlaylistsPlaylistsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -74,11 +78,6 @@ export class GetPlaylistsPlaylistsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetPlaylistsPlaylistsResponseBody"; } } @@ -134,264 +133,426 @@ export type GetPlaylistsResponse = { }; /** @internal */ +export const PlaylistType$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(PlaylistType); + +/** @internal */ +export const PlaylistType$outboundSchema: z.ZodNativeEnum = + PlaylistType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PlaylistType$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(PlaylistType); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `PlaylistType$inboundSchema` instead. */ + export const inboundSchema = PlaylistType$inboundSchema; + /** @deprecated use `PlaylistType$outboundSchema` instead. */ + export const outboundSchema = PlaylistType$outboundSchema; } /** @internal */ +export const QueryParamSmart$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(QueryParamSmart); + +/** @internal */ +export const QueryParamSmart$outboundSchema: z.ZodNativeEnum = + QueryParamSmart$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace QueryParamSmart$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(QueryParamSmart); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `QueryParamSmart$inboundSchema` instead. */ + export const inboundSchema = QueryParamSmart$inboundSchema; + /** @deprecated use `QueryParamSmart$outboundSchema` instead. */ + export const outboundSchema = QueryParamSmart$outboundSchema; } /** @internal */ +export const GetPlaylistsRequest$inboundSchema: z.ZodType< + GetPlaylistsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistType: PlaylistType$inboundSchema.optional(), + smart: QueryParamSmart$inboundSchema.optional(), +}); + +/** @internal */ +export type GetPlaylistsRequest$Outbound = { + playlistType?: string | undefined; + smart?: number | undefined; +}; + +/** @internal */ +export const GetPlaylistsRequest$outboundSchema: z.ZodType< + GetPlaylistsRequest$Outbound, + z.ZodTypeDef, + GetPlaylistsRequest +> = z.object({ + playlistType: PlaylistType$outboundSchema.optional(), + smart: QueryParamSmart$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistsRequest$ { - export const inboundSchema: z.ZodType = z.object({ - playlistType: PlaylistType$.inboundSchema.optional(), - smart: QueryParamSmart$.inboundSchema.optional(), - }); - - export type Outbound = { - playlistType?: string | undefined; - smart?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - playlistType: PlaylistType$.outboundSchema.optional(), - smart: QueryParamSmart$.outboundSchema.optional(), - }); + /** @deprecated use `GetPlaylistsRequest$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsRequest$inboundSchema; + /** @deprecated use `GetPlaylistsRequest$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsRequest$outboundSchema; + /** @deprecated use `GetPlaylistsRequest$Outbound` instead. */ + export type Outbound = GetPlaylistsRequest$Outbound; } /** @internal */ +export const GetPlaylistsErrors$inboundSchema: z.ZodType< + GetPlaylistsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetPlaylistsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetPlaylistsErrors$outboundSchema: z.ZodType< + GetPlaylistsErrors$Outbound, + z.ZodTypeDef, + GetPlaylistsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistsErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetPlaylistsErrors$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsErrors$inboundSchema; + /** @deprecated use `GetPlaylistsErrors$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsErrors$outboundSchema; + /** @deprecated use `GetPlaylistsErrors$Outbound` instead. */ + export type Outbound = GetPlaylistsErrors$Outbound; } /** @internal */ -export namespace GetPlaylistsPlaylistsResponseBody$ { - export const inboundSchema: z.ZodType< - GetPlaylistsPlaylistsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetPlaylistsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetPlaylistsPlaylistsResponseBody(remapped); +export const GetPlaylistsPlaylistsResponseBody$inboundSchema: z.ZodType< + GetPlaylistsPlaylistsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetPlaylistsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetPlaylistsPlaylistsResponseBody - > = z - .instanceof(GetPlaylistsPlaylistsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetPlaylistsErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace GetPlaylistsMetadata$ { - export const inboundSchema: z.ZodType = z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - icon: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), + return new GetPlaylistsPlaylistsResponseBody(remapped); }); - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - type?: string | undefined; - title?: string | undefined; - summary?: string | undefined; - smart?: boolean | undefined; - playlistType?: string | undefined; - composite?: string | undefined; - icon?: string | undefined; - viewCount?: number | undefined; - lastViewedAt?: number | undefined; - duration?: number | undefined; - leafCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - }; +/** @internal */ +export type GetPlaylistsPlaylistsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export const outboundSchema: z.ZodType = z.object( - { - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - summary: z.string().optional(), - smart: z.boolean().optional(), - playlistType: z.string().optional(), - composite: z.string().optional(), - icon: z.string().optional(), - viewCount: z.number().int().optional(), - lastViewedAt: z.number().int().optional(), - duration: z.number().int().optional(), - leafCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - } +/** @internal */ +export const GetPlaylistsPlaylistsResponseBody$outboundSchema: z.ZodType< + GetPlaylistsPlaylistsResponseBody$Outbound, + z.ZodTypeDef, + GetPlaylistsPlaylistsResponseBody +> = z + .instanceof(GetPlaylistsPlaylistsResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetPlaylistsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistsPlaylistsResponseBody$ { + /** @deprecated use `GetPlaylistsPlaylistsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsPlaylistsResponseBody$inboundSchema; + /** @deprecated use `GetPlaylistsPlaylistsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsPlaylistsResponseBody$outboundSchema; + /** @deprecated use `GetPlaylistsPlaylistsResponseBody$Outbound` instead. */ + export type Outbound = GetPlaylistsPlaylistsResponseBody$Outbound; } /** @internal */ +export const GetPlaylistsMetadata$inboundSchema: z.ZodType< + GetPlaylistsMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + icon: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** @internal */ +export type GetPlaylistsMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + type?: string | undefined; + title?: string | undefined; + summary?: string | undefined; + smart?: boolean | undefined; + playlistType?: string | undefined; + composite?: string | undefined; + icon?: string | undefined; + viewCount?: number | undefined; + lastViewedAt?: number | undefined; + duration?: number | undefined; + leafCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; +}; + +/** @internal */ +export const GetPlaylistsMetadata$outboundSchema: z.ZodType< + GetPlaylistsMetadata$Outbound, + z.ZodTypeDef, + GetPlaylistsMetadata +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + summary: z.string().optional(), + smart: z.boolean().optional(), + playlistType: z.string().optional(), + composite: z.string().optional(), + icon: z.string().optional(), + viewCount: z.number().int().optional(), + lastViewedAt: z.number().int().optional(), + duration: z.number().int().optional(), + leafCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetPlaylistsMetadata$ { + /** @deprecated use `GetPlaylistsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsMetadata$inboundSchema; + /** @deprecated use `GetPlaylistsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsMetadata$outboundSchema; + /** @deprecated use `GetPlaylistsMetadata$Outbound` instead. */ + export type Outbound = GetPlaylistsMetadata$Outbound; +} + +/** @internal */ +export const GetPlaylistsMediaContainer$inboundSchema: z.ZodType< + GetPlaylistsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Metadata: z.array(z.lazy(() => GetPlaylistsMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetPlaylistsMediaContainer$Outbound = { + size?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetPlaylistsMediaContainer$outboundSchema: z.ZodType< + GetPlaylistsMediaContainer$Outbound, + z.ZodTypeDef, + GetPlaylistsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + metadata: z.array(z.lazy(() => GetPlaylistsMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - Metadata: z.array(z.lazy(() => GetPlaylistsMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - metadata: z.array(z.lazy(() => GetPlaylistsMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetPlaylistsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsMediaContainer$inboundSchema; + /** @deprecated use `GetPlaylistsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsMediaContainer$outboundSchema; + /** @deprecated use `GetPlaylistsMediaContainer$Outbound` instead. */ + export type Outbound = GetPlaylistsMediaContainer$Outbound; } /** @internal */ +export const GetPlaylistsResponseBody$inboundSchema: z.ZodType< + GetPlaylistsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetPlaylistsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetPlaylistsResponseBody$Outbound = { + MediaContainer?: GetPlaylistsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetPlaylistsResponseBody$outboundSchema: z.ZodType< + GetPlaylistsResponseBody$Outbound, + z.ZodTypeDef, + GetPlaylistsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetPlaylistsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetPlaylistsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetPlaylistsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetPlaylistsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetPlaylistsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsResponseBody$inboundSchema; + /** @deprecated use `GetPlaylistsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsResponseBody$outboundSchema; + /** @deprecated use `GetPlaylistsResponseBody$Outbound` instead. */ + export type Outbound = GetPlaylistsResponseBody$Outbound; } /** @internal */ +export const GetPlaylistsResponse$inboundSchema: z.ZodType< + GetPlaylistsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetPlaylistsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetPlaylistsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetPlaylistsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetPlaylistsResponse$outboundSchema: z.ZodType< + GetPlaylistsResponse$Outbound, + z.ZodTypeDef, + GetPlaylistsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetPlaylistsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetPlaylistsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetPlaylistsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetPlaylistsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetPlaylistsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetPlaylistsResponse$inboundSchema` instead. */ + export const inboundSchema = GetPlaylistsResponse$inboundSchema; + /** @deprecated use `GetPlaylistsResponse$outboundSchema` instead. */ + export const outboundSchema = GetPlaylistsResponse$outboundSchema; + /** @deprecated use `GetPlaylistsResponse$Outbound` instead. */ + export type Outbound = GetPlaylistsResponse$Outbound; } diff --git a/src/models/getrecentlyaddedop.ts b/src/models/getrecentlyaddedop.ts index b154088c..1207e363 100644 --- a/src/models/getrecentlyaddedop.ts +++ b/src/models/getrecentlyaddedop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetRecentlyAddedLibraryResponseBody extends Error { data$: GetRecentlyAddedLibraryResponseBodyData; constructor(err: GetRecentlyAddedLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetRecentlyAddedLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetRecentlyAddedLibraryResponseBody"; } } @@ -179,520 +178,730 @@ export type GetRecentlyAddedResponse = { }; /** @internal */ +export const GetRecentlyAddedErrors$inboundSchema: z.ZodType< + GetRecentlyAddedErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetRecentlyAddedErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetRecentlyAddedErrors$outboundSchema: z.ZodType< + GetRecentlyAddedErrors$Outbound, + z.ZodTypeDef, + GetRecentlyAddedErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetRecentlyAddedErrors$ { - export const inboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } - ); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetRecentlyAddedErrors$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedErrors$inboundSchema; + /** @deprecated use `GetRecentlyAddedErrors$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedErrors$outboundSchema; + /** @deprecated use `GetRecentlyAddedErrors$Outbound` instead. */ + export type Outbound = GetRecentlyAddedErrors$Outbound; } /** @internal */ -export namespace GetRecentlyAddedLibraryResponseBody$ { - export const inboundSchema: z.ZodType< - GetRecentlyAddedLibraryResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetRecentlyAddedErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetRecentlyAddedLibraryResponseBody(remapped); +export const GetRecentlyAddedLibraryResponseBody$inboundSchema: z.ZodType< + GetRecentlyAddedLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetRecentlyAddedErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetRecentlyAddedLibraryResponseBody - > = z - .instanceof(GetRecentlyAddedLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetRecentlyAddedErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new GetRecentlyAddedLibraryResponseBody(remapped); + }); /** @internal */ -export namespace Part$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - key: z.string().optional(), - duration: z.number().optional(), - file: z.string().optional(), - size: z.number().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - hasThumbnail: z.number().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - container?: string | undefined; - has64bitOffsets?: boolean | undefined; - hasThumbnail?: number | undefined; - optimizedForStreaming?: boolean | undefined; - videoProfile?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - key: z.string().optional(), - duration: z.number().optional(), - file: z.string().optional(), - size: z.number().optional(), - container: z.string().optional(), - has64bitOffsets: z.boolean().optional(), - hasThumbnail: z.number().optional(), - optimizedForStreaming: z.boolean().optional(), - videoProfile: z.string().optional(), - }); -} +export type GetRecentlyAddedLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetRecentlyAddedMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - duration: z.number().optional(), - bitrate: z.number().optional(), - width: z.number().optional(), - height: z.number().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.number().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => Part$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: number | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - optimizedForStreaming?: number | undefined; - has64bitOffsets?: boolean | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - duration: z.number().optional(), - bitrate: z.number().optional(), - width: z.number().optional(), - height: z.number().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.number().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - optimizedForStreaming: z.number().optional(), - has64bitOffsets: z.boolean().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => Part$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); -} - -/** @internal */ -export namespace Genre$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace Director$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace Writer$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace Country$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace Role$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetRecentlyAddedMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - librarySectionID: z.number().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - ratingKey: z.number().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().optional(), - originallyAvailableAt: z - .string() - .datetime({ offset: true }) - .transform((v) => new Date(v)) - .optional(), - addedAt: z.number().optional(), - updatedAt: z.number().optional(), - audienceRatingImage: z.string().optional(), - chapterSource: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - Media: z.array(z.lazy(() => GetRecentlyAddedMedia$.inboundSchema)).optional(), - Genre: z.array(z.lazy(() => Genre$.inboundSchema)).optional(), - Director: z.array(z.lazy(() => Director$.inboundSchema)).optional(), - Writer: z.array(z.lazy(() => Writer$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => Country$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => Role$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - Genre: "genre", - Director: "director", - Writer: "writer", - Country: "country", - Role: "role", - }); - }); - - export type Outbound = { - allowSync?: boolean | undefined; - librarySectionID?: number | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - ratingKey?: number | undefined; - key?: string | undefined; - guid?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - rating?: number | undefined; - audienceRating?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - audienceRatingImage?: string | undefined; - chapterSource?: string | undefined; - primaryExtraKey?: string | undefined; - ratingImage?: string | undefined; - Media?: Array | undefined; - Genre?: Array | undefined; - Director?: Array | undefined; - Writer?: Array | undefined; - Country?: Array | undefined; - Role?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - librarySectionID: z.number().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - ratingKey: z.number().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().optional(), - originallyAvailableAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - addedAt: z.number().optional(), - updatedAt: z.number().optional(), - audienceRatingImage: z.string().optional(), - chapterSource: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - media: z.array(z.lazy(() => GetRecentlyAddedMedia$.outboundSchema)).optional(), - genre: z.array(z.lazy(() => Genre$.outboundSchema)).optional(), - director: z.array(z.lazy(() => Director$.outboundSchema)).optional(), - writer: z.array(z.lazy(() => Writer$.outboundSchema)).optional(), - country: z.array(z.lazy(() => Country$.outboundSchema)).optional(), - role: z.array(z.lazy(() => Role$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - genre: "Genre", - director: "Director", - writer: "Writer", - country: "Country", - role: "Role", - }); - }); -} - -/** @internal */ -export namespace GetRecentlyAddedMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().optional(), - mixedParents: z.boolean().optional(), - Metadata: z.array(z.lazy(() => GetRecentlyAddedMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - identifier?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - mixedParents?: boolean | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetRecentlyAddedLibraryResponseBody$outboundSchema: z.ZodType< + GetRecentlyAddedLibraryResponseBody$Outbound, + z.ZodTypeDef, + GetRecentlyAddedLibraryResponseBody +> = z + .instanceof(GetRecentlyAddedLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - size: z.number().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().optional(), - mixedParents: z.boolean().optional(), - metadata: z - .array(z.lazy(() => GetRecentlyAddedMetadata$.outboundSchema)) + errors: z.array(z.lazy(() => GetRecentlyAddedErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - metadata: "Metadata", + rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetRecentlyAddedLibraryResponseBody$ { + /** @deprecated use `GetRecentlyAddedLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedLibraryResponseBody$inboundSchema; + /** @deprecated use `GetRecentlyAddedLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedLibraryResponseBody$outboundSchema; + /** @deprecated use `GetRecentlyAddedLibraryResponseBody$Outbound` instead. */ + export type Outbound = GetRecentlyAddedLibraryResponseBody$Outbound; } /** @internal */ +export const Part$inboundSchema: z.ZodType = z.object({ + id: z.number().optional(), + key: z.string().optional(), + duration: z.number().optional(), + file: z.string().optional(), + size: z.number().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + hasThumbnail: z.number().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), +}); + +/** @internal */ +export type Part$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + container?: string | undefined; + has64bitOffsets?: boolean | undefined; + hasThumbnail?: number | undefined; + optimizedForStreaming?: boolean | undefined; + videoProfile?: string | undefined; +}; + +/** @internal */ +export const Part$outboundSchema: z.ZodType = z.object({ + id: z.number().optional(), + key: z.string().optional(), + duration: z.number().optional(), + file: z.string().optional(), + size: z.number().optional(), + container: z.string().optional(), + has64bitOffsets: z.boolean().optional(), + hasThumbnail: z.number().optional(), + optimizedForStreaming: z.boolean().optional(), + videoProfile: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Part$ { + /** @deprecated use `Part$inboundSchema` instead. */ + export const inboundSchema = Part$inboundSchema; + /** @deprecated use `Part$outboundSchema` instead. */ + export const outboundSchema = Part$outboundSchema; + /** @deprecated use `Part$Outbound` instead. */ + export type Outbound = Part$Outbound; +} + +/** @internal */ +export const GetRecentlyAddedMedia$inboundSchema: z.ZodType< + GetRecentlyAddedMedia, + z.ZodTypeDef, + unknown +> = z + .object({ + id: z.number().optional(), + duration: z.number().optional(), + bitrate: z.number().optional(), + width: z.number().optional(), + height: z.number().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.number().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => Part$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetRecentlyAddedMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: number | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + optimizedForStreaming?: number | undefined; + has64bitOffsets?: boolean | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetRecentlyAddedMedia$outboundSchema: z.ZodType< + GetRecentlyAddedMedia$Outbound, + z.ZodTypeDef, + GetRecentlyAddedMedia +> = z + .object({ + id: z.number().optional(), + duration: z.number().optional(), + bitrate: z.number().optional(), + width: z.number().optional(), + height: z.number().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.number().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + optimizedForStreaming: z.number().optional(), + has64bitOffsets: z.boolean().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => Part$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetRecentlyAddedMedia$ { + /** @deprecated use `GetRecentlyAddedMedia$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedMedia$inboundSchema; + /** @deprecated use `GetRecentlyAddedMedia$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedMedia$outboundSchema; + /** @deprecated use `GetRecentlyAddedMedia$Outbound` instead. */ + export type Outbound = GetRecentlyAddedMedia$Outbound; +} + +/** @internal */ +export const Genre$inboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type Genre$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const Genre$outboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Genre$ { + /** @deprecated use `Genre$inboundSchema` instead. */ + export const inboundSchema = Genre$inboundSchema; + /** @deprecated use `Genre$outboundSchema` instead. */ + export const outboundSchema = Genre$outboundSchema; + /** @deprecated use `Genre$Outbound` instead. */ + export type Outbound = Genre$Outbound; +} + +/** @internal */ +export const Director$inboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type Director$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const Director$outboundSchema: z.ZodType = + z.object({ + tag: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Director$ { + /** @deprecated use `Director$inboundSchema` instead. */ + export const inboundSchema = Director$inboundSchema; + /** @deprecated use `Director$outboundSchema` instead. */ + export const outboundSchema = Director$outboundSchema; + /** @deprecated use `Director$Outbound` instead. */ + export type Outbound = Director$Outbound; +} + +/** @internal */ +export const Writer$inboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type Writer$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const Writer$outboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Writer$ { + /** @deprecated use `Writer$inboundSchema` instead. */ + export const inboundSchema = Writer$inboundSchema; + /** @deprecated use `Writer$outboundSchema` instead. */ + export const outboundSchema = Writer$outboundSchema; + /** @deprecated use `Writer$Outbound` instead. */ + export type Outbound = Writer$Outbound; +} + +/** @internal */ +export const Country$inboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type Country$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const Country$outboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Country$ { + /** @deprecated use `Country$inboundSchema` instead. */ + export const inboundSchema = Country$inboundSchema; + /** @deprecated use `Country$outboundSchema` instead. */ + export const outboundSchema = Country$outboundSchema; + /** @deprecated use `Country$Outbound` instead. */ + export type Outbound = Country$Outbound; +} + +/** @internal */ +export const Role$inboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type Role$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const Role$outboundSchema: z.ZodType = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Role$ { + /** @deprecated use `Role$inboundSchema` instead. */ + export const inboundSchema = Role$inboundSchema; + /** @deprecated use `Role$outboundSchema` instead. */ + export const outboundSchema = Role$outboundSchema; + /** @deprecated use `Role$Outbound` instead. */ + export type Outbound = Role$Outbound; +} + +/** @internal */ +export const GetRecentlyAddedMetadata$inboundSchema: z.ZodType< + GetRecentlyAddedMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + allowSync: z.boolean().optional(), + librarySectionID: z.number().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + ratingKey: z.number().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().optional(), + originallyAvailableAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + .optional(), + addedAt: z.number().optional(), + updatedAt: z.number().optional(), + audienceRatingImage: z.string().optional(), + chapterSource: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + Media: z.array(z.lazy(() => GetRecentlyAddedMedia$inboundSchema)).optional(), + Genre: z.array(z.lazy(() => Genre$inboundSchema)).optional(), + Director: z.array(z.lazy(() => Director$inboundSchema)).optional(), + Writer: z.array(z.lazy(() => Writer$inboundSchema)).optional(), + Country: z.array(z.lazy(() => Country$inboundSchema)).optional(), + Role: z.array(z.lazy(() => Role$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + Genre: "genre", + Director: "director", + Writer: "writer", + Country: "country", + Role: "role", + }); + }); + +/** @internal */ +export type GetRecentlyAddedMetadata$Outbound = { + allowSync?: boolean | undefined; + librarySectionID?: number | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + ratingKey?: number | undefined; + key?: string | undefined; + guid?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + rating?: number | undefined; + audienceRating?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + audienceRatingImage?: string | undefined; + chapterSource?: string | undefined; + primaryExtraKey?: string | undefined; + ratingImage?: string | undefined; + Media?: Array | undefined; + Genre?: Array | undefined; + Director?: Array | undefined; + Writer?: Array | undefined; + Country?: Array | undefined; + Role?: Array | undefined; +}; + +/** @internal */ +export const GetRecentlyAddedMetadata$outboundSchema: z.ZodType< + GetRecentlyAddedMetadata$Outbound, + z.ZodTypeDef, + GetRecentlyAddedMetadata +> = z + .object({ + allowSync: z.boolean().optional(), + librarySectionID: z.number().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + ratingKey: z.number().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().optional(), + originallyAvailableAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + addedAt: z.number().optional(), + updatedAt: z.number().optional(), + audienceRatingImage: z.string().optional(), + chapterSource: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + media: z.array(z.lazy(() => GetRecentlyAddedMedia$outboundSchema)).optional(), + genre: z.array(z.lazy(() => Genre$outboundSchema)).optional(), + director: z.array(z.lazy(() => Director$outboundSchema)).optional(), + writer: z.array(z.lazy(() => Writer$outboundSchema)).optional(), + country: z.array(z.lazy(() => Country$outboundSchema)).optional(), + role: z.array(z.lazy(() => Role$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + genre: "Genre", + director: "Director", + writer: "Writer", + country: "Country", + role: "Role", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetRecentlyAddedMetadata$ { + /** @deprecated use `GetRecentlyAddedMetadata$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedMetadata$inboundSchema; + /** @deprecated use `GetRecentlyAddedMetadata$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedMetadata$outboundSchema; + /** @deprecated use `GetRecentlyAddedMetadata$Outbound` instead. */ + export type Outbound = GetRecentlyAddedMetadata$Outbound; +} + +/** @internal */ +export const GetRecentlyAddedMediaContainer$inboundSchema: z.ZodType< + GetRecentlyAddedMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().optional(), + mixedParents: z.boolean().optional(), + Metadata: z.array(z.lazy(() => GetRecentlyAddedMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetRecentlyAddedMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + identifier?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + mixedParents?: boolean | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetRecentlyAddedMediaContainer$outboundSchema: z.ZodType< + GetRecentlyAddedMediaContainer$Outbound, + z.ZodTypeDef, + GetRecentlyAddedMediaContainer +> = z + .object({ + size: z.number().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().optional(), + mixedParents: z.boolean().optional(), + metadata: z.array(z.lazy(() => GetRecentlyAddedMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetRecentlyAddedMediaContainer$ { + /** @deprecated use `GetRecentlyAddedMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedMediaContainer$inboundSchema; + /** @deprecated use `GetRecentlyAddedMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedMediaContainer$outboundSchema; + /** @deprecated use `GetRecentlyAddedMediaContainer$Outbound` instead. */ + export type Outbound = GetRecentlyAddedMediaContainer$Outbound; +} + +/** @internal */ +export const GetRecentlyAddedResponseBody$inboundSchema: z.ZodType< + GetRecentlyAddedResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetRecentlyAddedMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetRecentlyAddedResponseBody$Outbound = { + MediaContainer?: GetRecentlyAddedMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetRecentlyAddedResponseBody$outboundSchema: z.ZodType< + GetRecentlyAddedResponseBody$Outbound, + z.ZodTypeDef, + GetRecentlyAddedResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetRecentlyAddedMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetRecentlyAddedResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetRecentlyAddedMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetRecentlyAddedMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetRecentlyAddedMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetRecentlyAddedResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedResponseBody$inboundSchema; + /** @deprecated use `GetRecentlyAddedResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedResponseBody$outboundSchema; + /** @deprecated use `GetRecentlyAddedResponseBody$Outbound` instead. */ + export type Outbound = GetRecentlyAddedResponseBody$Outbound; } /** @internal */ +export const GetRecentlyAddedResponse$inboundSchema: z.ZodType< + GetRecentlyAddedResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetRecentlyAddedResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetRecentlyAddedResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetRecentlyAddedResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetRecentlyAddedResponse$outboundSchema: z.ZodType< + GetRecentlyAddedResponse$Outbound, + z.ZodTypeDef, + GetRecentlyAddedResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetRecentlyAddedResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetRecentlyAddedResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetRecentlyAddedResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetRecentlyAddedResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetRecentlyAddedResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetRecentlyAddedResponse$inboundSchema` instead. */ + export const inboundSchema = GetRecentlyAddedResponse$inboundSchema; + /** @deprecated use `GetRecentlyAddedResponse$outboundSchema` instead. */ + export const outboundSchema = GetRecentlyAddedResponse$outboundSchema; + /** @deprecated use `GetRecentlyAddedResponse$Outbound` instead. */ + export type Outbound = GetRecentlyAddedResponse$Outbound; } diff --git a/src/models/getresizedphotoop.ts b/src/models/getresizedphotoop.ts index 843cbb4f..cf90f71f 100644 --- a/src/models/getresizedphotoop.ts +++ b/src/models/getresizedphotoop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -83,7 +83,11 @@ export class GetResizedPhotoResponseBody extends Error { data$: GetResizedPhotoResponseBodyData; constructor(err: GetResizedPhotoResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -93,11 +97,6 @@ export class GetResizedPhotoResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetResizedPhotoResponseBody"; } } @@ -118,152 +117,254 @@ export type GetResizedPhotoResponse = { }; /** @internal */ +export const MinSize$inboundSchema: z.ZodNativeEnum = z.nativeEnum(MinSize); + +/** @internal */ +export const MinSize$outboundSchema: z.ZodNativeEnum = MinSize$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MinSize$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(MinSize); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `MinSize$inboundSchema` instead. */ + export const inboundSchema = MinSize$inboundSchema; + /** @deprecated use `MinSize$outboundSchema` instead. */ + export const outboundSchema = MinSize$outboundSchema; } /** @internal */ +export const Upscale$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Upscale); + +/** @internal */ +export const Upscale$outboundSchema: z.ZodNativeEnum = Upscale$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Upscale$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Upscale); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Upscale$inboundSchema` instead. */ + export const inboundSchema = Upscale$inboundSchema; + /** @deprecated use `Upscale$outboundSchema` instead. */ + export const outboundSchema = Upscale$outboundSchema; } /** @internal */ +export const GetResizedPhotoRequest$inboundSchema: z.ZodType< + GetResizedPhotoRequest, + z.ZodTypeDef, + unknown +> = z.object({ + width: z.number(), + height: z.number(), + opacity: z.number().int().default(100), + blur: z.number(), + minSize: MinSize$inboundSchema, + upscale: Upscale$inboundSchema, + url: z.string(), +}); + +/** @internal */ +export type GetResizedPhotoRequest$Outbound = { + width: number; + height: number; + opacity: number; + blur: number; + minSize: number; + upscale: number; + url: string; +}; + +/** @internal */ +export const GetResizedPhotoRequest$outboundSchema: z.ZodType< + GetResizedPhotoRequest$Outbound, + z.ZodTypeDef, + GetResizedPhotoRequest +> = z.object({ + width: z.number(), + height: z.number(), + opacity: z.number().int().default(100), + blur: z.number(), + minSize: MinSize$outboundSchema, + upscale: Upscale$outboundSchema, + url: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetResizedPhotoRequest$ { - export const inboundSchema: z.ZodType = z.object( - { - width: z.number(), - height: z.number(), - opacity: z.number().int().default(100), - blur: z.number(), - minSize: MinSize$.inboundSchema, - upscale: Upscale$.inboundSchema, - url: z.string(), - } - ); - - export type Outbound = { - width: number; - height: number; - opacity: number; - blur: number; - minSize: number; - upscale: number; - url: string; - }; - - export const outboundSchema: z.ZodType = - z.object({ - width: z.number(), - height: z.number(), - opacity: z.number().int().default(100), - blur: z.number(), - minSize: MinSize$.outboundSchema, - upscale: Upscale$.outboundSchema, - url: z.string(), - }); + /** @deprecated use `GetResizedPhotoRequest$inboundSchema` instead. */ + export const inboundSchema = GetResizedPhotoRequest$inboundSchema; + /** @deprecated use `GetResizedPhotoRequest$outboundSchema` instead. */ + export const outboundSchema = GetResizedPhotoRequest$outboundSchema; + /** @deprecated use `GetResizedPhotoRequest$Outbound` instead. */ + export type Outbound = GetResizedPhotoRequest$Outbound; } /** @internal */ +export const GetResizedPhotoErrors$inboundSchema: z.ZodType< + GetResizedPhotoErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetResizedPhotoErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetResizedPhotoErrors$outboundSchema: z.ZodType< + GetResizedPhotoErrors$Outbound, + z.ZodTypeDef, + GetResizedPhotoErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetResizedPhotoErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `GetResizedPhotoErrors$inboundSchema` instead. */ + export const inboundSchema = GetResizedPhotoErrors$inboundSchema; + /** @deprecated use `GetResizedPhotoErrors$outboundSchema` instead. */ + export const outboundSchema = GetResizedPhotoErrors$outboundSchema; + /** @deprecated use `GetResizedPhotoErrors$Outbound` instead. */ + export type Outbound = GetResizedPhotoErrors$Outbound; +} + +/** @internal */ +export const GetResizedPhotoResponseBody$inboundSchema: z.ZodType< + GetResizedPhotoResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetResizedPhotoErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetResizedPhotoResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} +/** @internal */ +export type GetResizedPhotoResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ +export const GetResizedPhotoResponseBody$outboundSchema: z.ZodType< + GetResizedPhotoResponseBody$Outbound, + z.ZodTypeDef, + GetResizedPhotoResponseBody +> = z + .instanceof(GetResizedPhotoResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetResizedPhotoErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetResizedPhotoResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetResizedPhotoErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetResizedPhotoResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetResizedPhotoResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetResizedPhotoErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetResizedPhotoResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetResizedPhotoResponseBody$inboundSchema; + /** @deprecated use `GetResizedPhotoResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetResizedPhotoResponseBody$outboundSchema; + /** @deprecated use `GetResizedPhotoResponseBody$Outbound` instead. */ + export type Outbound = GetResizedPhotoResponseBody$Outbound; } /** @internal */ +export const GetResizedPhotoResponse$inboundSchema: z.ZodType< + GetResizedPhotoResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetResizedPhotoResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const GetResizedPhotoResponse$outboundSchema: z.ZodType< + GetResizedPhotoResponse$Outbound, + z.ZodTypeDef, + GetResizedPhotoResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetResizedPhotoResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetResizedPhotoResponse$inboundSchema` instead. */ + export const inboundSchema = GetResizedPhotoResponse$inboundSchema; + /** @deprecated use `GetResizedPhotoResponse$outboundSchema` instead. */ + export const outboundSchema = GetResizedPhotoResponse$outboundSchema; + /** @deprecated use `GetResizedPhotoResponse$Outbound` instead. */ + export type Outbound = GetResizedPhotoResponse$Outbound; } diff --git a/src/models/getresourcesop.ts b/src/models/getresourcesop.ts new file mode 100644 index 00000000..e615fca5 --- /dev/null +++ b/src/models/getresourcesop.ts @@ -0,0 +1,671 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const GetResourcesOpServerList = ["https://plex.tv/api/v2"] as const; + +export type GetResourcesGlobals = { + /** + * The unique identifier for the client application + * + * @remarks + * This is used to track the client application and its usage + * (UUID, serial number, or other number unique per device) + * + */ + xPlexClientIdentifier?: string | undefined; +}; + +/** + * Include Https entries in the results + */ +export enum IncludeHttps { + Zero = 0, + One = 1, +} + +/** + * Include Relay addresses in the results + */ +export enum IncludeRelay { + Zero = 0, + One = 1, +} + +/** + * Include IPv6 entries in the results + */ +export enum IncludeIPv6 { + Zero = 0, + One = 1, +} + +export type GetResourcesRequest = { + /** + * The unique identifier for the client application + * + * @remarks + * This is used to track the client application and its usage + * (UUID, serial number, or other number unique per device) + * + */ + xPlexClientIdentifier?: string | undefined; + /** + * Include Https entries in the results + */ + includeHttps?: IncludeHttps | undefined; + /** + * Include Relay addresses in the results + */ + includeRelay?: IncludeRelay | undefined; + /** + * Include IPv6 entries in the results + */ + includeIPv6?: IncludeIPv6 | undefined; +}; + +export type GetResourcesErrors = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export type GetResourcesResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export class GetResourcesResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: GetResourcesResponseBodyData; + + constructor(err: GetResourcesResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "GetResourcesResponseBody"; + } +} + +export type Connections = { + protocol?: string | undefined; + address?: string | undefined; + port?: number | undefined; + uri?: string | undefined; + local?: boolean | undefined; + relay?: boolean | undefined; + iPv6?: boolean | undefined; +}; + +export type PlexDevice = { + name: string; + product: string; + productVersion: string; + platform: string; + platformVersion: string; + device: string; + clientIdentifier: string; + createdAt: Date; + lastSeenAt: Date; + provides: string; + ownerId?: string | undefined; + sourceTitle?: string | undefined; + publicAddress?: string | undefined; + accessToken?: string | undefined; + owned?: boolean | undefined; + home?: boolean | undefined; + synced?: boolean | undefined; + relay?: boolean | undefined; + presence?: boolean | undefined; + httpsRequired?: boolean | undefined; + publicAddressMatches?: boolean | undefined; + dnsRebindingProtection?: boolean | undefined; + natLoopbackSupported?: boolean | undefined; + connections?: Array | undefined; +}; + +export type GetResourcesResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * List of Plex Devices. This includes Plex hosted servers and clients + */ + plexDevices?: Array | undefined; +}; + +/** @internal */ +export const GetResourcesGlobals$inboundSchema: z.ZodType< + GetResourcesGlobals, + z.ZodTypeDef, + unknown +> = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + }); + }); + +/** @internal */ +export type GetResourcesGlobals$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; +}; + +/** @internal */ +export const GetResourcesGlobals$outboundSchema: z.ZodType< + GetResourcesGlobals$Outbound, + z.ZodTypeDef, + GetResourcesGlobals +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesGlobals$ { + /** @deprecated use `GetResourcesGlobals$inboundSchema` instead. */ + export const inboundSchema = GetResourcesGlobals$inboundSchema; + /** @deprecated use `GetResourcesGlobals$outboundSchema` instead. */ + export const outboundSchema = GetResourcesGlobals$outboundSchema; + /** @deprecated use `GetResourcesGlobals$Outbound` instead. */ + export type Outbound = GetResourcesGlobals$Outbound; +} + +/** @internal */ +export const IncludeHttps$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(IncludeHttps); + +/** @internal */ +export const IncludeHttps$outboundSchema: z.ZodNativeEnum = + IncludeHttps$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IncludeHttps$ { + /** @deprecated use `IncludeHttps$inboundSchema` instead. */ + export const inboundSchema = IncludeHttps$inboundSchema; + /** @deprecated use `IncludeHttps$outboundSchema` instead. */ + export const outboundSchema = IncludeHttps$outboundSchema; +} + +/** @internal */ +export const IncludeRelay$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(IncludeRelay); + +/** @internal */ +export const IncludeRelay$outboundSchema: z.ZodNativeEnum = + IncludeRelay$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IncludeRelay$ { + /** @deprecated use `IncludeRelay$inboundSchema` instead. */ + export const inboundSchema = IncludeRelay$inboundSchema; + /** @deprecated use `IncludeRelay$outboundSchema` instead. */ + export const outboundSchema = IncludeRelay$outboundSchema; +} + +/** @internal */ +export const IncludeIPv6$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(IncludeIPv6); + +/** @internal */ +export const IncludeIPv6$outboundSchema: z.ZodNativeEnum = + IncludeIPv6$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IncludeIPv6$ { + /** @deprecated use `IncludeIPv6$inboundSchema` instead. */ + export const inboundSchema = IncludeIPv6$inboundSchema; + /** @deprecated use `IncludeIPv6$outboundSchema` instead. */ + export const outboundSchema = IncludeIPv6$outboundSchema; +} + +/** @internal */ +export const GetResourcesRequest$inboundSchema: z.ZodType< + GetResourcesRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + includeHttps: IncludeHttps$inboundSchema.optional(), + includeRelay: IncludeRelay$inboundSchema.optional(), + includeIPv6: IncludeIPv6$inboundSchema.optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + }); + }); + +/** @internal */ +export type GetResourcesRequest$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; + includeHttps?: number | undefined; + includeRelay?: number | undefined; + includeIPv6?: number | undefined; +}; + +/** @internal */ +export const GetResourcesRequest$outboundSchema: z.ZodType< + GetResourcesRequest$Outbound, + z.ZodTypeDef, + GetResourcesRequest +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + includeHttps: IncludeHttps$outboundSchema.optional(), + includeRelay: IncludeRelay$outboundSchema.optional(), + includeIPv6: IncludeIPv6$outboundSchema.optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesRequest$ { + /** @deprecated use `GetResourcesRequest$inboundSchema` instead. */ + export const inboundSchema = GetResourcesRequest$inboundSchema; + /** @deprecated use `GetResourcesRequest$outboundSchema` instead. */ + export const outboundSchema = GetResourcesRequest$outboundSchema; + /** @deprecated use `GetResourcesRequest$Outbound` instead. */ + export type Outbound = GetResourcesRequest$Outbound; +} + +/** @internal */ +export const GetResourcesErrors$inboundSchema: z.ZodType< + GetResourcesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetResourcesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetResourcesErrors$outboundSchema: z.ZodType< + GetResourcesErrors$Outbound, + z.ZodTypeDef, + GetResourcesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesErrors$ { + /** @deprecated use `GetResourcesErrors$inboundSchema` instead. */ + export const inboundSchema = GetResourcesErrors$inboundSchema; + /** @deprecated use `GetResourcesErrors$outboundSchema` instead. */ + export const outboundSchema = GetResourcesErrors$outboundSchema; + /** @deprecated use `GetResourcesErrors$Outbound` instead. */ + export type Outbound = GetResourcesErrors$Outbound; +} + +/** @internal */ +export const GetResourcesResponseBody$inboundSchema: z.ZodType< + GetResourcesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetResourcesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetResourcesResponseBody(remapped); + }); + +/** @internal */ +export type GetResourcesResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetResourcesResponseBody$outboundSchema: z.ZodType< + GetResourcesResponseBody$Outbound, + z.ZodTypeDef, + GetResourcesResponseBody +> = z + .instanceof(GetResourcesResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetResourcesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesResponseBody$ { + /** @deprecated use `GetResourcesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetResourcesResponseBody$inboundSchema; + /** @deprecated use `GetResourcesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetResourcesResponseBody$outboundSchema; + /** @deprecated use `GetResourcesResponseBody$Outbound` instead. */ + export type Outbound = GetResourcesResponseBody$Outbound; +} + +/** @internal */ +export const Connections$inboundSchema: z.ZodType = z + .object({ + protocol: z.string().optional(), + address: z.string().optional(), + port: z.number().optional(), + uri: z.string().optional(), + local: z.boolean().optional(), + relay: z.boolean().optional(), + IPv6: z.boolean().optional(), + }) + .transform((v) => { + return remap$(v, { + IPv6: "iPv6", + }); + }); + +/** @internal */ +export type Connections$Outbound = { + protocol?: string | undefined; + address?: string | undefined; + port?: number | undefined; + uri?: string | undefined; + local?: boolean | undefined; + relay?: boolean | undefined; + IPv6?: boolean | undefined; +}; + +/** @internal */ +export const Connections$outboundSchema: z.ZodType< + Connections$Outbound, + z.ZodTypeDef, + Connections +> = z + .object({ + protocol: z.string().optional(), + address: z.string().optional(), + port: z.number().optional(), + uri: z.string().optional(), + local: z.boolean().optional(), + relay: z.boolean().optional(), + iPv6: z.boolean().optional(), + }) + .transform((v) => { + return remap$(v, { + iPv6: "IPv6", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Connections$ { + /** @deprecated use `Connections$inboundSchema` instead. */ + export const inboundSchema = Connections$inboundSchema; + /** @deprecated use `Connections$outboundSchema` instead. */ + export const outboundSchema = Connections$outboundSchema; + /** @deprecated use `Connections$Outbound` instead. */ + export type Outbound = Connections$Outbound; +} + +/** @internal */ +export const PlexDevice$inboundSchema: z.ZodType = z.object({ + name: z.string(), + product: z.string(), + productVersion: z.string(), + platform: z.string(), + platformVersion: z.string(), + device: z.string(), + clientIdentifier: z.string(), + createdAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)), + lastSeenAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)), + provides: z.string(), + ownerId: z.string().optional(), + sourceTitle: z.string().optional(), + publicAddress: z.string().optional(), + accessToken: z.string().optional(), + owned: z.boolean().optional(), + home: z.boolean().optional(), + synced: z.boolean().optional(), + relay: z.boolean().optional(), + presence: z.boolean().optional(), + httpsRequired: z.boolean().optional(), + publicAddressMatches: z.boolean().optional(), + dnsRebindingProtection: z.boolean().optional(), + natLoopbackSupported: z.boolean().optional(), + connections: z.array(z.lazy(() => Connections$inboundSchema)).optional(), +}); + +/** @internal */ +export type PlexDevice$Outbound = { + name: string; + product: string; + productVersion: string; + platform: string; + platformVersion: string; + device: string; + clientIdentifier: string; + createdAt: string; + lastSeenAt: string; + provides: string; + ownerId?: string | undefined; + sourceTitle?: string | undefined; + publicAddress?: string | undefined; + accessToken?: string | undefined; + owned?: boolean | undefined; + home?: boolean | undefined; + synced?: boolean | undefined; + relay?: boolean | undefined; + presence?: boolean | undefined; + httpsRequired?: boolean | undefined; + publicAddressMatches?: boolean | undefined; + dnsRebindingProtection?: boolean | undefined; + natLoopbackSupported?: boolean | undefined; + connections?: Array | undefined; +}; + +/** @internal */ +export const PlexDevice$outboundSchema: z.ZodType = + z.object({ + name: z.string(), + product: z.string(), + productVersion: z.string(), + platform: z.string(), + platformVersion: z.string(), + device: z.string(), + clientIdentifier: z.string(), + createdAt: z.date().transform((v) => v.toISOString()), + lastSeenAt: z.date().transform((v) => v.toISOString()), + provides: z.string(), + ownerId: z.string().optional(), + sourceTitle: z.string().optional(), + publicAddress: z.string().optional(), + accessToken: z.string().optional(), + owned: z.boolean().optional(), + home: z.boolean().optional(), + synced: z.boolean().optional(), + relay: z.boolean().optional(), + presence: z.boolean().optional(), + httpsRequired: z.boolean().optional(), + publicAddressMatches: z.boolean().optional(), + dnsRebindingProtection: z.boolean().optional(), + natLoopbackSupported: z.boolean().optional(), + connections: z.array(z.lazy(() => Connections$outboundSchema)).optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PlexDevice$ { + /** @deprecated use `PlexDevice$inboundSchema` instead. */ + export const inboundSchema = PlexDevice$inboundSchema; + /** @deprecated use `PlexDevice$outboundSchema` instead. */ + export const outboundSchema = PlexDevice$outboundSchema; + /** @deprecated use `PlexDevice$Outbound` instead. */ + export type Outbound = PlexDevice$Outbound; +} + +/** @internal */ +export const GetResourcesResponse$inboundSchema: z.ZodType< + GetResourcesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + PlexDevices: z.array(z.lazy(() => PlexDevice$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + PlexDevices: "plexDevices", + }); + }); + +/** @internal */ +export type GetResourcesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + PlexDevices?: Array | undefined; +}; + +/** @internal */ +export const GetResourcesResponse$outboundSchema: z.ZodType< + GetResourcesResponse$Outbound, + z.ZodTypeDef, + GetResourcesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + plexDevices: z.array(z.lazy(() => PlexDevice$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + plexDevices: "PlexDevices", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesResponse$ { + /** @deprecated use `GetResourcesResponse$inboundSchema` instead. */ + export const inboundSchema = GetResourcesResponse$inboundSchema; + /** @deprecated use `GetResourcesResponse$outboundSchema` instead. */ + export const outboundSchema = GetResourcesResponse$outboundSchema; + /** @deprecated use `GetResourcesResponse$Outbound` instead. */ + export type Outbound = GetResourcesResponse$Outbound; +} diff --git a/src/models/getresourcesstatisticsop.ts b/src/models/getresourcesstatisticsop.ts index 9720e60c..fa372d84 100644 --- a/src/models/getresourcesstatisticsop.ts +++ b/src/models/getresourcesstatisticsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -47,7 +47,11 @@ export class GetResourcesStatisticsStatisticsResponseBody extends Error { data$: GetResourcesStatisticsStatisticsResponseBodyData; constructor(err: GetResourcesStatisticsStatisticsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -57,11 +61,6 @@ export class GetResourcesStatisticsStatisticsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetResourcesStatisticsStatisticsResponseBody"; } } @@ -107,258 +106,371 @@ export type GetResourcesStatisticsResponse = { }; /** @internal */ +export const GetResourcesStatisticsRequest$inboundSchema: z.ZodType< + GetResourcesStatisticsRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + Timespan: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + Timespan: "timespan", + }); + }); + +/** @internal */ +export type GetResourcesStatisticsRequest$Outbound = { + Timespan?: number | undefined; +}; + +/** @internal */ +export const GetResourcesStatisticsRequest$outboundSchema: z.ZodType< + GetResourcesStatisticsRequest$Outbound, + z.ZodTypeDef, + GetResourcesStatisticsRequest +> = z + .object({ + timespan: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + timespan: "Timespan", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetResourcesStatisticsRequest$ { - export const inboundSchema: z.ZodType = z - .object({ - Timespan: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - Timespan: "timespan", - }); - }); - - export type Outbound = { - Timespan?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z - .object({ - timespan: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - timespan: "Timespan", - }); - }); + /** @deprecated use `GetResourcesStatisticsRequest$inboundSchema` instead. */ + export const inboundSchema = GetResourcesStatisticsRequest$inboundSchema; + /** @deprecated use `GetResourcesStatisticsRequest$outboundSchema` instead. */ + export const outboundSchema = GetResourcesStatisticsRequest$outboundSchema; + /** @deprecated use `GetResourcesStatisticsRequest$Outbound` instead. */ + export type Outbound = GetResourcesStatisticsRequest$Outbound; } /** @internal */ +export const GetResourcesStatisticsErrors$inboundSchema: z.ZodType< + GetResourcesStatisticsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetResourcesStatisticsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetResourcesStatisticsErrors$outboundSchema: z.ZodType< + GetResourcesStatisticsErrors$Outbound, + z.ZodTypeDef, + GetResourcesStatisticsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetResourcesStatisticsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetResourcesStatisticsErrors$inboundSchema` instead. */ + export const inboundSchema = GetResourcesStatisticsErrors$inboundSchema; + /** @deprecated use `GetResourcesStatisticsErrors$outboundSchema` instead. */ + export const outboundSchema = GetResourcesStatisticsErrors$outboundSchema; + /** @deprecated use `GetResourcesStatisticsErrors$Outbound` instead. */ + export type Outbound = GetResourcesStatisticsErrors$Outbound; } /** @internal */ -export namespace GetResourcesStatisticsStatisticsResponseBody$ { - export const inboundSchema: z.ZodType< - GetResourcesStatisticsStatisticsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetResourcesStatisticsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetResourcesStatisticsStatisticsResponseBody(remapped); +export const GetResourcesStatisticsStatisticsResponseBody$inboundSchema: z.ZodType< + GetResourcesStatisticsStatisticsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetResourcesStatisticsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetResourcesStatisticsStatisticsResponseBody - > = z - .instanceof(GetResourcesStatisticsStatisticsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetResourcesStatisticsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace StatisticsResources$ { - export const inboundSchema: z.ZodType = z.object({ - timespan: z.number().int().optional(), - at: z.number().int().optional(), - hostCpuUtilization: z.number().optional(), - processCpuUtilization: z.number().optional(), - hostMemoryUtilization: z.number().optional(), - processMemoryUtilization: z.number().optional(), + return new GetResourcesStatisticsStatisticsResponseBody(remapped); }); - export type Outbound = { - timespan?: number | undefined; - at?: number | undefined; - hostCpuUtilization?: number | undefined; - processCpuUtilization?: number | undefined; - hostMemoryUtilization?: number | undefined; - processMemoryUtilization?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - timespan: z.number().int().optional(), - at: z.number().int().optional(), - hostCpuUtilization: z.number().optional(), - processCpuUtilization: z.number().optional(), - hostMemoryUtilization: z.number().optional(), - processMemoryUtilization: z.number().optional(), - }); -} +/** @internal */ +export type GetResourcesStatisticsStatisticsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetResourcesStatisticsMediaContainer$ { - export const inboundSchema: z.ZodType< - GetResourcesStatisticsMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - StatisticsResources: z - .array(z.lazy(() => StatisticsResources$.inboundSchema)) - .optional(), - }) - .transform((v) => { - return remap$(v, { - StatisticsResources: "statisticsResources", - }); - }); - - export type Outbound = { - size?: number | undefined; - StatisticsResources?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetResourcesStatisticsMediaContainer - > = z - .object({ - size: z.number().int().optional(), - statisticsResources: z - .array(z.lazy(() => StatisticsResources$.outboundSchema)) - .optional(), - }) - .transform((v) => { - return remap$(v, { - statisticsResources: "StatisticsResources", - }); - }); -} - -/** @internal */ -export namespace GetResourcesStatisticsResponseBody$ { - export const inboundSchema: z.ZodType< - GetResourcesStatisticsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - MediaContainer: z - .lazy(() => GetResourcesStatisticsMediaContainer$.inboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetResourcesStatisticsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetResourcesStatisticsResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetResourcesStatisticsMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); -} - -/** @internal */ -export namespace GetResourcesStatisticsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetResourcesStatisticsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetResourcesStatisticsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetResourcesStatisticsStatisticsResponseBody$outboundSchema: z.ZodType< + GetResourcesStatisticsStatisticsResponseBody$Outbound, + z.ZodTypeDef, + GetResourcesStatisticsStatisticsResponseBody +> = z + .instanceof(GetResourcesStatisticsStatisticsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetResourcesStatisticsResponseBody$.outboundSchema).optional(), + errors: z + .array(z.lazy(() => GetResourcesStatisticsErrors$outboundSchema)) + .optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesStatisticsStatisticsResponseBody$ { + /** @deprecated use `GetResourcesStatisticsStatisticsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetResourcesStatisticsStatisticsResponseBody$inboundSchema; + /** @deprecated use `GetResourcesStatisticsStatisticsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetResourcesStatisticsStatisticsResponseBody$outboundSchema; + /** @deprecated use `GetResourcesStatisticsStatisticsResponseBody$Outbound` instead. */ + export type Outbound = GetResourcesStatisticsStatisticsResponseBody$Outbound; +} + +/** @internal */ +export const StatisticsResources$inboundSchema: z.ZodType< + StatisticsResources, + z.ZodTypeDef, + unknown +> = z.object({ + timespan: z.number().int().optional(), + at: z.number().int().optional(), + hostCpuUtilization: z.number().optional(), + processCpuUtilization: z.number().optional(), + hostMemoryUtilization: z.number().optional(), + processMemoryUtilization: z.number().optional(), +}); + +/** @internal */ +export type StatisticsResources$Outbound = { + timespan?: number | undefined; + at?: number | undefined; + hostCpuUtilization?: number | undefined; + processCpuUtilization?: number | undefined; + hostMemoryUtilization?: number | undefined; + processMemoryUtilization?: number | undefined; +}; + +/** @internal */ +export const StatisticsResources$outboundSchema: z.ZodType< + StatisticsResources$Outbound, + z.ZodTypeDef, + StatisticsResources +> = z.object({ + timespan: z.number().int().optional(), + at: z.number().int().optional(), + hostCpuUtilization: z.number().optional(), + processCpuUtilization: z.number().optional(), + hostMemoryUtilization: z.number().optional(), + processMemoryUtilization: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StatisticsResources$ { + /** @deprecated use `StatisticsResources$inboundSchema` instead. */ + export const inboundSchema = StatisticsResources$inboundSchema; + /** @deprecated use `StatisticsResources$outboundSchema` instead. */ + export const outboundSchema = StatisticsResources$outboundSchema; + /** @deprecated use `StatisticsResources$Outbound` instead. */ + export type Outbound = StatisticsResources$Outbound; +} + +/** @internal */ +export const GetResourcesStatisticsMediaContainer$inboundSchema: z.ZodType< + GetResourcesStatisticsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + StatisticsResources: z.array(z.lazy(() => StatisticsResources$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + StatisticsResources: "statisticsResources", + }); + }); + +/** @internal */ +export type GetResourcesStatisticsMediaContainer$Outbound = { + size?: number | undefined; + StatisticsResources?: Array | undefined; +}; + +/** @internal */ +export const GetResourcesStatisticsMediaContainer$outboundSchema: z.ZodType< + GetResourcesStatisticsMediaContainer$Outbound, + z.ZodTypeDef, + GetResourcesStatisticsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + statisticsResources: z.array(z.lazy(() => StatisticsResources$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + statisticsResources: "StatisticsResources", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesStatisticsMediaContainer$ { + /** @deprecated use `GetResourcesStatisticsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetResourcesStatisticsMediaContainer$inboundSchema; + /** @deprecated use `GetResourcesStatisticsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetResourcesStatisticsMediaContainer$outboundSchema; + /** @deprecated use `GetResourcesStatisticsMediaContainer$Outbound` instead. */ + export type Outbound = GetResourcesStatisticsMediaContainer$Outbound; +} + +/** @internal */ +export const GetResourcesStatisticsResponseBody$inboundSchema: z.ZodType< + GetResourcesStatisticsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetResourcesStatisticsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetResourcesStatisticsResponseBody$Outbound = { + MediaContainer?: GetResourcesStatisticsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetResourcesStatisticsResponseBody$outboundSchema: z.ZodType< + GetResourcesStatisticsResponseBody$Outbound, + z.ZodTypeDef, + GetResourcesStatisticsResponseBody +> = z + .object({ + mediaContainer: z + .lazy(() => GetResourcesStatisticsMediaContainer$outboundSchema) + .optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesStatisticsResponseBody$ { + /** @deprecated use `GetResourcesStatisticsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetResourcesStatisticsResponseBody$inboundSchema; + /** @deprecated use `GetResourcesStatisticsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetResourcesStatisticsResponseBody$outboundSchema; + /** @deprecated use `GetResourcesStatisticsResponseBody$Outbound` instead. */ + export type Outbound = GetResourcesStatisticsResponseBody$Outbound; +} + +/** @internal */ +export const GetResourcesStatisticsResponse$inboundSchema: z.ZodType< + GetResourcesStatisticsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetResourcesStatisticsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetResourcesStatisticsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetResourcesStatisticsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetResourcesStatisticsResponse$outboundSchema: z.ZodType< + GetResourcesStatisticsResponse$Outbound, + z.ZodTypeDef, + GetResourcesStatisticsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetResourcesStatisticsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetResourcesStatisticsResponse$ { + /** @deprecated use `GetResourcesStatisticsResponse$inboundSchema` instead. */ + export const inboundSchema = GetResourcesStatisticsResponse$inboundSchema; + /** @deprecated use `GetResourcesStatisticsResponse$outboundSchema` instead. */ + export const outboundSchema = GetResourcesStatisticsResponse$outboundSchema; + /** @deprecated use `GetResourcesStatisticsResponse$Outbound` instead. */ + export type Outbound = GetResourcesStatisticsResponse$Outbound; } diff --git a/src/models/getsearchresultsop.ts b/src/models/getsearchresultsop.ts index 4644d3b9..4395de6b 100644 --- a/src/models/getsearchresultsop.ts +++ b/src/models/getsearchresultsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class GetSearchResultsSearchResponseBody extends Error { data$: GetSearchResultsSearchResponseBodyData; constructor(err: GetSearchResultsSearchResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class GetSearchResultsSearchResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetSearchResultsSearchResponseBody"; } } @@ -190,566 +189,844 @@ export type GetSearchResultsResponse = { }; /** @internal */ +export const GetSearchResultsRequest$inboundSchema: z.ZodType< + GetSearchResultsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + query: z.string(), +}); + +/** @internal */ +export type GetSearchResultsRequest$Outbound = { + query: string; +}; + +/** @internal */ +export const GetSearchResultsRequest$outboundSchema: z.ZodType< + GetSearchResultsRequest$Outbound, + z.ZodTypeDef, + GetSearchResultsRequest +> = z.object({ + query: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSearchResultsRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - query: z.string(), - }); - - export type Outbound = { - query: string; - }; - - export const outboundSchema: z.ZodType = - z.object({ - query: z.string(), - }); + /** @deprecated use `GetSearchResultsRequest$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsRequest$inboundSchema; + /** @deprecated use `GetSearchResultsRequest$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsRequest$outboundSchema; + /** @deprecated use `GetSearchResultsRequest$Outbound` instead. */ + export type Outbound = GetSearchResultsRequest$Outbound; } /** @internal */ +export const GetSearchResultsErrors$inboundSchema: z.ZodType< + GetSearchResultsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetSearchResultsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetSearchResultsErrors$outboundSchema: z.ZodType< + GetSearchResultsErrors$Outbound, + z.ZodTypeDef, + GetSearchResultsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSearchResultsErrors$ { - export const inboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } - ); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetSearchResultsErrors$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsErrors$inboundSchema; + /** @deprecated use `GetSearchResultsErrors$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsErrors$outboundSchema; + /** @deprecated use `GetSearchResultsErrors$Outbound` instead. */ + export type Outbound = GetSearchResultsErrors$Outbound; } /** @internal */ -export namespace GetSearchResultsSearchResponseBody$ { - export const inboundSchema: z.ZodType< - GetSearchResultsSearchResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetSearchResultsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetSearchResultsSearchResponseBody(remapped); +export const GetSearchResultsSearchResponseBody$inboundSchema: z.ZodType< + GetSearchResultsSearchResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetSearchResultsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSearchResultsSearchResponseBody - > = z - .instanceof(GetSearchResultsSearchResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetSearchResultsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace GetSearchResultsPart$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - key: z.string().optional(), - duration: z.number().optional(), - file: z.string().optional(), - size: z.number().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - videoProfile: z.string().optional(), + return new GetSearchResultsSearchResponseBody(remapped); }); - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - size?: number | undefined; - audioProfile?: string | undefined; - container?: string | undefined; - videoProfile?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - id: z.number().optional(), - key: z.string().optional(), - duration: z.number().optional(), - file: z.string().optional(), - size: z.number().optional(), - audioProfile: z.string().optional(), - container: z.string().optional(), - videoProfile: z.string().optional(), - } - ); -} +/** @internal */ +export type GetSearchResultsSearchResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetSearchResultsMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - duration: z.number().optional(), - bitrate: z.number().optional(), - width: z.number().optional(), - height: z.number().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.number().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - audioProfile: z.string().optional(), - videoProfile: z.string().optional(), - Part: z.array(z.lazy(() => GetSearchResultsPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - id?: number | undefined; - duration?: number | undefined; - bitrate?: number | undefined; - width?: number | undefined; - height?: number | undefined; - aspectRatio?: number | undefined; - audioChannels?: number | undefined; - audioCodec?: string | undefined; - videoCodec?: string | undefined; - videoResolution?: number | undefined; - container?: string | undefined; - videoFrameRate?: string | undefined; - audioProfile?: string | undefined; - videoProfile?: string | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - id: z.number().optional(), - duration: z.number().optional(), - bitrate: z.number().optional(), - width: z.number().optional(), - height: z.number().optional(), - aspectRatio: z.number().optional(), - audioChannels: z.number().optional(), - audioCodec: z.string().optional(), - videoCodec: z.string().optional(), - videoResolution: z.number().optional(), - container: z.string().optional(), - videoFrameRate: z.string().optional(), - audioProfile: z.string().optional(), - videoProfile: z.string().optional(), - part: z.array(z.lazy(() => GetSearchResultsPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); -} - -/** @internal */ -export namespace GetSearchResultsGenre$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetSearchResultsDirector$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetSearchResultsWriter$ { - export const inboundSchema: z.ZodType = z.object( - { - tag: z.string().optional(), - } - ); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetSearchResultsCountry$ { - export const inboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - tag: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetSearchResultsRole$ { - export const inboundSchema: z.ZodType = z.object({ - tag: z.string().optional(), - }); - - export type Outbound = { - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - tag: z.string().optional(), - } - ); -} - -/** @internal */ -export namespace GetSearchResultsMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - librarySectionID: z.number().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - personal: z.boolean().optional(), - sourceTitle: z.string().optional(), - ratingKey: z.number().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().optional(), - originallyAvailableAt: z - .string() - .datetime({ offset: true }) - .transform((v) => new Date(v)) - .optional(), - addedAt: z.number().optional(), - updatedAt: z.number().optional(), - audienceRatingImage: z.string().optional(), - chapterSource: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - Media: z.array(z.lazy(() => GetSearchResultsMedia$.inboundSchema)).optional(), - Genre: z.array(z.lazy(() => GetSearchResultsGenre$.inboundSchema)).optional(), - Director: z.array(z.lazy(() => GetSearchResultsDirector$.inboundSchema)).optional(), - Writer: z.array(z.lazy(() => GetSearchResultsWriter$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => GetSearchResultsCountry$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => GetSearchResultsRole$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - Genre: "genre", - Director: "director", - Writer: "writer", - Country: "country", - Role: "role", - }); - }); - - export type Outbound = { - allowSync?: boolean | undefined; - librarySectionID?: number | undefined; - librarySectionTitle?: string | undefined; - librarySectionUUID?: string | undefined; - personal?: boolean | undefined; - sourceTitle?: string | undefined; - ratingKey?: number | undefined; - key?: string | undefined; - guid?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - rating?: number | undefined; - audienceRating?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - audienceRatingImage?: string | undefined; - chapterSource?: string | undefined; - primaryExtraKey?: string | undefined; - ratingImage?: string | undefined; - Media?: Array | undefined; - Genre?: Array | undefined; - Director?: Array | undefined; - Writer?: Array | undefined; - Country?: Array | undefined; - Role?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - allowSync: z.boolean().optional(), - librarySectionID: z.number().optional(), - librarySectionTitle: z.string().optional(), - librarySectionUUID: z.string().optional(), - personal: z.boolean().optional(), - sourceTitle: z.string().optional(), - ratingKey: z.number().optional(), - key: z.string().optional(), - guid: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - rating: z.number().optional(), - audienceRating: z.number().optional(), - year: z.number().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().optional(), - originallyAvailableAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - addedAt: z.number().optional(), - updatedAt: z.number().optional(), - audienceRatingImage: z.string().optional(), - chapterSource: z.string().optional(), - primaryExtraKey: z.string().optional(), - ratingImage: z.string().optional(), - media: z.array(z.lazy(() => GetSearchResultsMedia$.outboundSchema)).optional(), - genre: z.array(z.lazy(() => GetSearchResultsGenre$.outboundSchema)).optional(), - director: z.array(z.lazy(() => GetSearchResultsDirector$.outboundSchema)).optional(), - writer: z.array(z.lazy(() => GetSearchResultsWriter$.outboundSchema)).optional(), - country: z.array(z.lazy(() => GetSearchResultsCountry$.outboundSchema)).optional(), - role: z.array(z.lazy(() => GetSearchResultsRole$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - genre: "Genre", - director: "Director", - writer: "Writer", - country: "Country", - role: "Role", - }); - }); -} - -/** @internal */ -export namespace Provider$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - }); - - export type Outbound = { - key?: string | undefined; - title?: string | undefined; - type?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - title: z.string().optional(), - type: z.string().optional(), - }); -} - -/** @internal */ -export namespace GetSearchResultsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().optional(), - Metadata: z.array(z.lazy(() => GetSearchResultsMetadata$.inboundSchema)).optional(), - Provider: z.array(z.lazy(() => Provider$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - Provider: "provider", - }); - }); - - export type Outbound = { - size?: number | undefined; - identifier?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - Metadata?: Array | undefined; - Provider?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetSearchResultsSearchResponseBody$outboundSchema: z.ZodType< + GetSearchResultsSearchResponseBody$Outbound, + z.ZodTypeDef, + GetSearchResultsSearchResponseBody +> = z + .instanceof(GetSearchResultsSearchResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - size: z.number().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().optional(), - metadata: z - .array(z.lazy(() => GetSearchResultsMetadata$.outboundSchema)) + errors: z.array(z.lazy(() => GetSearchResultsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), - provider: z.array(z.lazy(() => Provider$.outboundSchema)).optional(), }) .transform((v) => { return remap$(v, { - metadata: "Metadata", - provider: "Provider", + rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsSearchResponseBody$ { + /** @deprecated use `GetSearchResultsSearchResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsSearchResponseBody$inboundSchema; + /** @deprecated use `GetSearchResultsSearchResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsSearchResponseBody$outboundSchema; + /** @deprecated use `GetSearchResultsSearchResponseBody$Outbound` instead. */ + export type Outbound = GetSearchResultsSearchResponseBody$Outbound; } /** @internal */ +export const GetSearchResultsPart$inboundSchema: z.ZodType< + GetSearchResultsPart, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().optional(), + key: z.string().optional(), + duration: z.number().optional(), + file: z.string().optional(), + size: z.number().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + videoProfile: z.string().optional(), +}); + +/** @internal */ +export type GetSearchResultsPart$Outbound = { + id?: number | undefined; + key?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + size?: number | undefined; + audioProfile?: string | undefined; + container?: string | undefined; + videoProfile?: string | undefined; +}; + +/** @internal */ +export const GetSearchResultsPart$outboundSchema: z.ZodType< + GetSearchResultsPart$Outbound, + z.ZodTypeDef, + GetSearchResultsPart +> = z.object({ + id: z.number().optional(), + key: z.string().optional(), + duration: z.number().optional(), + file: z.string().optional(), + size: z.number().optional(), + audioProfile: z.string().optional(), + container: z.string().optional(), + videoProfile: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsPart$ { + /** @deprecated use `GetSearchResultsPart$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsPart$inboundSchema; + /** @deprecated use `GetSearchResultsPart$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsPart$outboundSchema; + /** @deprecated use `GetSearchResultsPart$Outbound` instead. */ + export type Outbound = GetSearchResultsPart$Outbound; +} + +/** @internal */ +export const GetSearchResultsMedia$inboundSchema: z.ZodType< + GetSearchResultsMedia, + z.ZodTypeDef, + unknown +> = z + .object({ + id: z.number().optional(), + duration: z.number().optional(), + bitrate: z.number().optional(), + width: z.number().optional(), + height: z.number().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.number().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + audioProfile: z.string().optional(), + videoProfile: z.string().optional(), + Part: z.array(z.lazy(() => GetSearchResultsPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetSearchResultsMedia$Outbound = { + id?: number | undefined; + duration?: number | undefined; + bitrate?: number | undefined; + width?: number | undefined; + height?: number | undefined; + aspectRatio?: number | undefined; + audioChannels?: number | undefined; + audioCodec?: string | undefined; + videoCodec?: string | undefined; + videoResolution?: number | undefined; + container?: string | undefined; + videoFrameRate?: string | undefined; + audioProfile?: string | undefined; + videoProfile?: string | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetSearchResultsMedia$outboundSchema: z.ZodType< + GetSearchResultsMedia$Outbound, + z.ZodTypeDef, + GetSearchResultsMedia +> = z + .object({ + id: z.number().optional(), + duration: z.number().optional(), + bitrate: z.number().optional(), + width: z.number().optional(), + height: z.number().optional(), + aspectRatio: z.number().optional(), + audioChannels: z.number().optional(), + audioCodec: z.string().optional(), + videoCodec: z.string().optional(), + videoResolution: z.number().optional(), + container: z.string().optional(), + videoFrameRate: z.string().optional(), + audioProfile: z.string().optional(), + videoProfile: z.string().optional(), + part: z.array(z.lazy(() => GetSearchResultsPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsMedia$ { + /** @deprecated use `GetSearchResultsMedia$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsMedia$inboundSchema; + /** @deprecated use `GetSearchResultsMedia$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsMedia$outboundSchema; + /** @deprecated use `GetSearchResultsMedia$Outbound` instead. */ + export type Outbound = GetSearchResultsMedia$Outbound; +} + +/** @internal */ +export const GetSearchResultsGenre$inboundSchema: z.ZodType< + GetSearchResultsGenre, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetSearchResultsGenre$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetSearchResultsGenre$outboundSchema: z.ZodType< + GetSearchResultsGenre$Outbound, + z.ZodTypeDef, + GetSearchResultsGenre +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsGenre$ { + /** @deprecated use `GetSearchResultsGenre$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsGenre$inboundSchema; + /** @deprecated use `GetSearchResultsGenre$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsGenre$outboundSchema; + /** @deprecated use `GetSearchResultsGenre$Outbound` instead. */ + export type Outbound = GetSearchResultsGenre$Outbound; +} + +/** @internal */ +export const GetSearchResultsDirector$inboundSchema: z.ZodType< + GetSearchResultsDirector, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetSearchResultsDirector$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetSearchResultsDirector$outboundSchema: z.ZodType< + GetSearchResultsDirector$Outbound, + z.ZodTypeDef, + GetSearchResultsDirector +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsDirector$ { + /** @deprecated use `GetSearchResultsDirector$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsDirector$inboundSchema; + /** @deprecated use `GetSearchResultsDirector$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsDirector$outboundSchema; + /** @deprecated use `GetSearchResultsDirector$Outbound` instead. */ + export type Outbound = GetSearchResultsDirector$Outbound; +} + +/** @internal */ +export const GetSearchResultsWriter$inboundSchema: z.ZodType< + GetSearchResultsWriter, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetSearchResultsWriter$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetSearchResultsWriter$outboundSchema: z.ZodType< + GetSearchResultsWriter$Outbound, + z.ZodTypeDef, + GetSearchResultsWriter +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsWriter$ { + /** @deprecated use `GetSearchResultsWriter$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsWriter$inboundSchema; + /** @deprecated use `GetSearchResultsWriter$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsWriter$outboundSchema; + /** @deprecated use `GetSearchResultsWriter$Outbound` instead. */ + export type Outbound = GetSearchResultsWriter$Outbound; +} + +/** @internal */ +export const GetSearchResultsCountry$inboundSchema: z.ZodType< + GetSearchResultsCountry, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetSearchResultsCountry$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetSearchResultsCountry$outboundSchema: z.ZodType< + GetSearchResultsCountry$Outbound, + z.ZodTypeDef, + GetSearchResultsCountry +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsCountry$ { + /** @deprecated use `GetSearchResultsCountry$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsCountry$inboundSchema; + /** @deprecated use `GetSearchResultsCountry$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsCountry$outboundSchema; + /** @deprecated use `GetSearchResultsCountry$Outbound` instead. */ + export type Outbound = GetSearchResultsCountry$Outbound; +} + +/** @internal */ +export const GetSearchResultsRole$inboundSchema: z.ZodType< + GetSearchResultsRole, + z.ZodTypeDef, + unknown +> = z.object({ + tag: z.string().optional(), +}); + +/** @internal */ +export type GetSearchResultsRole$Outbound = { + tag?: string | undefined; +}; + +/** @internal */ +export const GetSearchResultsRole$outboundSchema: z.ZodType< + GetSearchResultsRole$Outbound, + z.ZodTypeDef, + GetSearchResultsRole +> = z.object({ + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsRole$ { + /** @deprecated use `GetSearchResultsRole$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsRole$inboundSchema; + /** @deprecated use `GetSearchResultsRole$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsRole$outboundSchema; + /** @deprecated use `GetSearchResultsRole$Outbound` instead. */ + export type Outbound = GetSearchResultsRole$Outbound; +} + +/** @internal */ +export const GetSearchResultsMetadata$inboundSchema: z.ZodType< + GetSearchResultsMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + allowSync: z.boolean().optional(), + librarySectionID: z.number().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + personal: z.boolean().optional(), + sourceTitle: z.string().optional(), + ratingKey: z.number().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().optional(), + originallyAvailableAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + .optional(), + addedAt: z.number().optional(), + updatedAt: z.number().optional(), + audienceRatingImage: z.string().optional(), + chapterSource: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + Media: z.array(z.lazy(() => GetSearchResultsMedia$inboundSchema)).optional(), + Genre: z.array(z.lazy(() => GetSearchResultsGenre$inboundSchema)).optional(), + Director: z.array(z.lazy(() => GetSearchResultsDirector$inboundSchema)).optional(), + Writer: z.array(z.lazy(() => GetSearchResultsWriter$inboundSchema)).optional(), + Country: z.array(z.lazy(() => GetSearchResultsCountry$inboundSchema)).optional(), + Role: z.array(z.lazy(() => GetSearchResultsRole$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + Genre: "genre", + Director: "director", + Writer: "writer", + Country: "country", + Role: "role", + }); + }); + +/** @internal */ +export type GetSearchResultsMetadata$Outbound = { + allowSync?: boolean | undefined; + librarySectionID?: number | undefined; + librarySectionTitle?: string | undefined; + librarySectionUUID?: string | undefined; + personal?: boolean | undefined; + sourceTitle?: string | undefined; + ratingKey?: number | undefined; + key?: string | undefined; + guid?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + rating?: number | undefined; + audienceRating?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + audienceRatingImage?: string | undefined; + chapterSource?: string | undefined; + primaryExtraKey?: string | undefined; + ratingImage?: string | undefined; + Media?: Array | undefined; + Genre?: Array | undefined; + Director?: Array | undefined; + Writer?: Array | undefined; + Country?: Array | undefined; + Role?: Array | undefined; +}; + +/** @internal */ +export const GetSearchResultsMetadata$outboundSchema: z.ZodType< + GetSearchResultsMetadata$Outbound, + z.ZodTypeDef, + GetSearchResultsMetadata +> = z + .object({ + allowSync: z.boolean().optional(), + librarySectionID: z.number().optional(), + librarySectionTitle: z.string().optional(), + librarySectionUUID: z.string().optional(), + personal: z.boolean().optional(), + sourceTitle: z.string().optional(), + ratingKey: z.number().optional(), + key: z.string().optional(), + guid: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + rating: z.number().optional(), + audienceRating: z.number().optional(), + year: z.number().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().optional(), + originallyAvailableAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + addedAt: z.number().optional(), + updatedAt: z.number().optional(), + audienceRatingImage: z.string().optional(), + chapterSource: z.string().optional(), + primaryExtraKey: z.string().optional(), + ratingImage: z.string().optional(), + media: z.array(z.lazy(() => GetSearchResultsMedia$outboundSchema)).optional(), + genre: z.array(z.lazy(() => GetSearchResultsGenre$outboundSchema)).optional(), + director: z.array(z.lazy(() => GetSearchResultsDirector$outboundSchema)).optional(), + writer: z.array(z.lazy(() => GetSearchResultsWriter$outboundSchema)).optional(), + country: z.array(z.lazy(() => GetSearchResultsCountry$outboundSchema)).optional(), + role: z.array(z.lazy(() => GetSearchResultsRole$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + genre: "Genre", + director: "Director", + writer: "Writer", + country: "Country", + role: "Role", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsMetadata$ { + /** @deprecated use `GetSearchResultsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsMetadata$inboundSchema; + /** @deprecated use `GetSearchResultsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsMetadata$outboundSchema; + /** @deprecated use `GetSearchResultsMetadata$Outbound` instead. */ + export type Outbound = GetSearchResultsMetadata$Outbound; +} + +/** @internal */ +export const Provider$inboundSchema: z.ZodType = z.object({ + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), +}); + +/** @internal */ +export type Provider$Outbound = { + key?: string | undefined; + title?: string | undefined; + type?: string | undefined; +}; + +/** @internal */ +export const Provider$outboundSchema: z.ZodType = + z.object({ + key: z.string().optional(), + title: z.string().optional(), + type: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Provider$ { + /** @deprecated use `Provider$inboundSchema` instead. */ + export const inboundSchema = Provider$inboundSchema; + /** @deprecated use `Provider$outboundSchema` instead. */ + export const outboundSchema = Provider$outboundSchema; + /** @deprecated use `Provider$Outbound` instead. */ + export type Outbound = Provider$Outbound; +} + +/** @internal */ +export const GetSearchResultsMediaContainer$inboundSchema: z.ZodType< + GetSearchResultsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().optional(), + Metadata: z.array(z.lazy(() => GetSearchResultsMetadata$inboundSchema)).optional(), + Provider: z.array(z.lazy(() => Provider$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + Provider: "provider", + }); + }); + +/** @internal */ +export type GetSearchResultsMediaContainer$Outbound = { + size?: number | undefined; + identifier?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + Metadata?: Array | undefined; + Provider?: Array | undefined; +}; + +/** @internal */ +export const GetSearchResultsMediaContainer$outboundSchema: z.ZodType< + GetSearchResultsMediaContainer$Outbound, + z.ZodTypeDef, + GetSearchResultsMediaContainer +> = z + .object({ + size: z.number().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().optional(), + metadata: z.array(z.lazy(() => GetSearchResultsMetadata$outboundSchema)).optional(), + provider: z.array(z.lazy(() => Provider$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + provider: "Provider", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSearchResultsMediaContainer$ { + /** @deprecated use `GetSearchResultsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsMediaContainer$inboundSchema; + /** @deprecated use `GetSearchResultsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsMediaContainer$outboundSchema; + /** @deprecated use `GetSearchResultsMediaContainer$Outbound` instead. */ + export type Outbound = GetSearchResultsMediaContainer$Outbound; +} + +/** @internal */ +export const GetSearchResultsResponseBody$inboundSchema: z.ZodType< + GetSearchResultsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetSearchResultsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetSearchResultsResponseBody$Outbound = { + MediaContainer?: GetSearchResultsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetSearchResultsResponseBody$outboundSchema: z.ZodType< + GetSearchResultsResponseBody$Outbound, + z.ZodTypeDef, + GetSearchResultsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetSearchResultsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSearchResultsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetSearchResultsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetSearchResultsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetSearchResultsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetSearchResultsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsResponseBody$inboundSchema; + /** @deprecated use `GetSearchResultsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsResponseBody$outboundSchema; + /** @deprecated use `GetSearchResultsResponseBody$Outbound` instead. */ + export type Outbound = GetSearchResultsResponseBody$Outbound; } /** @internal */ +export const GetSearchResultsResponse$inboundSchema: z.ZodType< + GetSearchResultsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetSearchResultsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetSearchResultsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetSearchResultsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetSearchResultsResponse$outboundSchema: z.ZodType< + GetSearchResultsResponse$Outbound, + z.ZodTypeDef, + GetSearchResultsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetSearchResultsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSearchResultsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetSearchResultsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetSearchResultsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetSearchResultsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetSearchResultsResponse$inboundSchema` instead. */ + export const inboundSchema = GetSearchResultsResponse$inboundSchema; + /** @deprecated use `GetSearchResultsResponse$outboundSchema` instead. */ + export const outboundSchema = GetSearchResultsResponse$outboundSchema; + /** @deprecated use `GetSearchResultsResponse$Outbound` instead. */ + export type Outbound = GetSearchResultsResponse$Outbound; } diff --git a/src/models/getserveractivitiesop.ts b/src/models/getserveractivitiesop.ts index cca05194..2c527147 100644 --- a/src/models/getserveractivitiesop.ts +++ b/src/models/getserveractivitiesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetServerActivitiesActivitiesResponseBody extends Error { data$: GetServerActivitiesActivitiesResponseBodyData; constructor(err: GetServerActivitiesActivitiesResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetServerActivitiesActivitiesResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetServerActivitiesActivitiesResponseBody"; } } @@ -102,255 +101,357 @@ export type GetServerActivitiesResponse = { }; /** @internal */ +export const GetServerActivitiesErrors$inboundSchema: z.ZodType< + GetServerActivitiesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetServerActivitiesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetServerActivitiesErrors$outboundSchema: z.ZodType< + GetServerActivitiesErrors$Outbound, + z.ZodTypeDef, + GetServerActivitiesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerActivitiesErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetServerActivitiesErrors$inboundSchema` instead. */ + export const inboundSchema = GetServerActivitiesErrors$inboundSchema; + /** @deprecated use `GetServerActivitiesErrors$outboundSchema` instead. */ + export const outboundSchema = GetServerActivitiesErrors$outboundSchema; + /** @deprecated use `GetServerActivitiesErrors$Outbound` instead. */ + export type Outbound = GetServerActivitiesErrors$Outbound; } /** @internal */ -export namespace GetServerActivitiesActivitiesResponseBody$ { - export const inboundSchema: z.ZodType< - GetServerActivitiesActivitiesResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetServerActivitiesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetServerActivitiesActivitiesResponseBody(remapped); +export const GetServerActivitiesActivitiesResponseBody$inboundSchema: z.ZodType< + GetServerActivitiesActivitiesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetServerActivitiesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerActivitiesActivitiesResponseBody - > = z - .instanceof(GetServerActivitiesActivitiesResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetServerActivitiesErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace Context$ { - export const inboundSchema: z.ZodType = z.object({ - librarySectionID: z.string().optional(), + return new GetServerActivitiesActivitiesResponseBody(remapped); }); - export type Outbound = { - librarySectionID?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - librarySectionID: z.string().optional(), - }); -} +/** @internal */ +export type GetServerActivitiesActivitiesResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace Activity$ { - export const inboundSchema: z.ZodType = z - .object({ - uuid: z.string().optional(), - type: z.string().optional(), - cancellable: z.boolean().optional(), - userID: z.number().optional(), - title: z.string().optional(), - subtitle: z.string().optional(), - progress: z.number().optional(), - Context: z.lazy(() => Context$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - Context: "context", - }); - }); - - export type Outbound = { - uuid?: string | undefined; - type?: string | undefined; - cancellable?: boolean | undefined; - userID?: number | undefined; - title?: string | undefined; - subtitle?: string | undefined; - progress?: number | undefined; - Context?: Context$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - uuid: z.string().optional(), - type: z.string().optional(), - cancellable: z.boolean().optional(), - userID: z.number().optional(), - title: z.string().optional(), - subtitle: z.string().optional(), - progress: z.number().optional(), - context: z.lazy(() => Context$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - context: "Context", - }); - }); -} - -/** @internal */ -export namespace GetServerActivitiesMediaContainer$ { - export const inboundSchema: z.ZodType< - GetServerActivitiesMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().optional(), - Activity: z.array(z.lazy(() => Activity$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Activity: "activity", - }); - }); - - export type Outbound = { - size?: number | undefined; - Activity?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerActivitiesMediaContainer - > = z - .object({ - size: z.number().optional(), - activity: z.array(z.lazy(() => Activity$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - activity: "Activity", - }); - }); -} - -/** @internal */ -export namespace GetServerActivitiesResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetServerActivitiesActivitiesResponseBody$outboundSchema: z.ZodType< + GetServerActivitiesActivitiesResponseBody$Outbound, + z.ZodTypeDef, + GetServerActivitiesActivitiesResponseBody +> = z + .instanceof(GetServerActivitiesActivitiesResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => GetServerActivitiesMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => GetServerActivitiesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: GetServerActivitiesMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerActivitiesResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetServerActivitiesMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerActivitiesActivitiesResponseBody$ { + /** @deprecated use `GetServerActivitiesActivitiesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerActivitiesActivitiesResponseBody$inboundSchema; + /** @deprecated use `GetServerActivitiesActivitiesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerActivitiesActivitiesResponseBody$outboundSchema; + /** @deprecated use `GetServerActivitiesActivitiesResponseBody$Outbound` instead. */ + export type Outbound = GetServerActivitiesActivitiesResponseBody$Outbound; } /** @internal */ -export namespace GetServerActivitiesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetServerActivitiesResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const Context$inboundSchema: z.ZodType = z.object({ + librarySectionID: z.string().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetServerActivitiesResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type Context$Outbound = { + librarySectionID?: string | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetServerActivitiesResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const Context$outboundSchema: z.ZodType = z.object({ + librarySectionID: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Context$ { + /** @deprecated use `Context$inboundSchema` instead. */ + export const inboundSchema = Context$inboundSchema; + /** @deprecated use `Context$outboundSchema` instead. */ + export const outboundSchema = Context$outboundSchema; + /** @deprecated use `Context$Outbound` instead. */ + export type Outbound = Context$Outbound; +} + +/** @internal */ +export const Activity$inboundSchema: z.ZodType = z + .object({ + uuid: z.string().optional(), + type: z.string().optional(), + cancellable: z.boolean().optional(), + userID: z.number().optional(), + title: z.string().optional(), + subtitle: z.string().optional(), + progress: z.number().optional(), + Context: z.lazy(() => Context$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + Context: "context", + }); + }); + +/** @internal */ +export type Activity$Outbound = { + uuid?: string | undefined; + type?: string | undefined; + cancellable?: boolean | undefined; + userID?: number | undefined; + title?: string | undefined; + subtitle?: string | undefined; + progress?: number | undefined; + Context?: Context$Outbound | undefined; +}; + +/** @internal */ +export const Activity$outboundSchema: z.ZodType = z + .object({ + uuid: z.string().optional(), + type: z.string().optional(), + cancellable: z.boolean().optional(), + userID: z.number().optional(), + title: z.string().optional(), + subtitle: z.string().optional(), + progress: z.number().optional(), + context: z.lazy(() => Context$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + context: "Context", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Activity$ { + /** @deprecated use `Activity$inboundSchema` instead. */ + export const inboundSchema = Activity$inboundSchema; + /** @deprecated use `Activity$outboundSchema` instead. */ + export const outboundSchema = Activity$outboundSchema; + /** @deprecated use `Activity$Outbound` instead. */ + export type Outbound = Activity$Outbound; +} + +/** @internal */ +export const GetServerActivitiesMediaContainer$inboundSchema: z.ZodType< + GetServerActivitiesMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + Activity: z.array(z.lazy(() => Activity$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Activity: "activity", + }); + }); + +/** @internal */ +export type GetServerActivitiesMediaContainer$Outbound = { + size?: number | undefined; + Activity?: Array | undefined; +}; + +/** @internal */ +export const GetServerActivitiesMediaContainer$outboundSchema: z.ZodType< + GetServerActivitiesMediaContainer$Outbound, + z.ZodTypeDef, + GetServerActivitiesMediaContainer +> = z + .object({ + size: z.number().optional(), + activity: z.array(z.lazy(() => Activity$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + activity: "Activity", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerActivitiesMediaContainer$ { + /** @deprecated use `GetServerActivitiesMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetServerActivitiesMediaContainer$inboundSchema; + /** @deprecated use `GetServerActivitiesMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetServerActivitiesMediaContainer$outboundSchema; + /** @deprecated use `GetServerActivitiesMediaContainer$Outbound` instead. */ + export type Outbound = GetServerActivitiesMediaContainer$Outbound; +} + +/** @internal */ +export const GetServerActivitiesResponseBody$inboundSchema: z.ZodType< + GetServerActivitiesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetServerActivitiesMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetServerActivitiesResponseBody$Outbound = { + MediaContainer?: GetServerActivitiesMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetServerActivitiesResponseBody$outboundSchema: z.ZodType< + GetServerActivitiesResponseBody$Outbound, + z.ZodTypeDef, + GetServerActivitiesResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetServerActivitiesMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerActivitiesResponseBody$ { + /** @deprecated use `GetServerActivitiesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerActivitiesResponseBody$inboundSchema; + /** @deprecated use `GetServerActivitiesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerActivitiesResponseBody$outboundSchema; + /** @deprecated use `GetServerActivitiesResponseBody$Outbound` instead. */ + export type Outbound = GetServerActivitiesResponseBody$Outbound; +} + +/** @internal */ +export const GetServerActivitiesResponse$inboundSchema: z.ZodType< + GetServerActivitiesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetServerActivitiesResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetServerActivitiesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetServerActivitiesResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetServerActivitiesResponse$outboundSchema: z.ZodType< + GetServerActivitiesResponse$Outbound, + z.ZodTypeDef, + GetServerActivitiesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetServerActivitiesResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerActivitiesResponse$ { + /** @deprecated use `GetServerActivitiesResponse$inboundSchema` instead. */ + export const inboundSchema = GetServerActivitiesResponse$inboundSchema; + /** @deprecated use `GetServerActivitiesResponse$outboundSchema` instead. */ + export const outboundSchema = GetServerActivitiesResponse$outboundSchema; + /** @deprecated use `GetServerActivitiesResponse$Outbound` instead. */ + export type Outbound = GetServerActivitiesResponse$Outbound; } diff --git a/src/models/getservercapabilitiesop.ts b/src/models/getservercapabilitiesop.ts index 58e468a8..863acc44 100644 --- a/src/models/getservercapabilitiesop.ts +++ b/src/models/getservercapabilitiesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetServerCapabilitiesServerResponseBody extends Error { data$: GetServerCapabilitiesServerResponseBodyData; constructor(err: GetServerCapabilitiesServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetServerCapabilitiesServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetServerCapabilitiesServerResponseBody"; } } @@ -142,348 +141,438 @@ export type GetServerCapabilitiesResponse = { }; /** @internal */ +export const Errors$inboundSchema: z.ZodType = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type Errors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const Errors$outboundSchema: z.ZodType = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Errors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `Errors$inboundSchema` instead. */ + export const inboundSchema = Errors$inboundSchema; + /** @deprecated use `Errors$outboundSchema` instead. */ + export const outboundSchema = Errors$outboundSchema; + /** @deprecated use `Errors$Outbound` instead. */ + export type Outbound = Errors$Outbound; +} + +/** @internal */ +export const GetServerCapabilitiesServerResponseBody$inboundSchema: z.ZodType< + GetServerCapabilitiesServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => Errors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetServerCapabilitiesServerResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} +/** @internal */ +export type GetServerCapabilitiesServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetServerCapabilitiesServerResponseBody$ { - export const inboundSchema: z.ZodType< - GetServerCapabilitiesServerResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => Errors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetServerCapabilitiesServerResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerCapabilitiesServerResponseBody - > = z - .instanceof(GetServerCapabilitiesServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => Errors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace Directory$ { - export const inboundSchema: z.ZodType = z.object({ - count: z.number().optional(), - key: z.string().optional(), - title: z.string().optional(), - }); - - export type Outbound = { - count?: number | undefined; - key?: string | undefined; - title?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - count: z.number().optional(), - key: z.string().optional(), - title: z.string().optional(), - }); -} - -/** @internal */ -export namespace MediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - allowCameraUpload: z.boolean().optional(), - allowChannelAccess: z.boolean().optional(), - allowMediaDeletion: z.boolean().optional(), - allowSharing: z.boolean().optional(), - allowSync: z.boolean().optional(), - allowTuners: z.boolean().optional(), - backgroundProcessing: z.boolean().optional(), - certificate: z.boolean().optional(), - companionProxy: z.boolean().optional(), - countryCode: z.string().optional(), - diagnostics: z.string().optional(), - eventStream: z.boolean().optional(), - friendlyName: z.string().optional(), - hubSearch: z.boolean().optional(), - itemClusters: z.boolean().optional(), - livetv: z.number().optional(), - machineIdentifier: z.string().optional(), - mediaProviders: z.boolean().optional(), - multiuser: z.boolean().optional(), - musicAnalysis: z.number().optional(), - myPlex: z.boolean().optional(), - myPlexMappingState: z.string().optional(), - myPlexSigninState: z.string().optional(), - myPlexSubscription: z.boolean().optional(), - myPlexUsername: z.string().optional(), - offlineTranscode: z.number().optional(), - ownerFeatures: z.string().optional(), - photoAutoTag: z.boolean().optional(), - platform: z.string().optional(), - platformVersion: z.string().optional(), - pluginHost: z.boolean().optional(), - pushNotifications: z.boolean().optional(), - readOnlyLibraries: z.boolean().optional(), - streamingBrainABRVersion: z.number().optional(), - streamingBrainVersion: z.number().optional(), - sync: z.boolean().optional(), - transcoderActiveVideoSessions: z.number().optional(), - transcoderAudio: z.boolean().optional(), - transcoderLyrics: z.boolean().optional(), - transcoderPhoto: z.boolean().optional(), - transcoderSubtitles: z.boolean().optional(), - transcoderVideo: z.boolean().optional(), - transcoderVideoBitrates: z.string().optional(), - transcoderVideoQualities: z.string().optional(), - transcoderVideoResolutions: z.string().optional(), - updatedAt: z.number().optional(), - updater: z.boolean().optional(), - version: z.string().optional(), - voiceSearch: z.boolean().optional(), - Directory: z.array(z.lazy(() => Directory$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Directory: "directory", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowCameraUpload?: boolean | undefined; - allowChannelAccess?: boolean | undefined; - allowMediaDeletion?: boolean | undefined; - allowSharing?: boolean | undefined; - allowSync?: boolean | undefined; - allowTuners?: boolean | undefined; - backgroundProcessing?: boolean | undefined; - certificate?: boolean | undefined; - companionProxy?: boolean | undefined; - countryCode?: string | undefined; - diagnostics?: string | undefined; - eventStream?: boolean | undefined; - friendlyName?: string | undefined; - hubSearch?: boolean | undefined; - itemClusters?: boolean | undefined; - livetv?: number | undefined; - machineIdentifier?: string | undefined; - mediaProviders?: boolean | undefined; - multiuser?: boolean | undefined; - musicAnalysis?: number | undefined; - myPlex?: boolean | undefined; - myPlexMappingState?: string | undefined; - myPlexSigninState?: string | undefined; - myPlexSubscription?: boolean | undefined; - myPlexUsername?: string | undefined; - offlineTranscode?: number | undefined; - ownerFeatures?: string | undefined; - photoAutoTag?: boolean | undefined; - platform?: string | undefined; - platformVersion?: string | undefined; - pluginHost?: boolean | undefined; - pushNotifications?: boolean | undefined; - readOnlyLibraries?: boolean | undefined; - streamingBrainABRVersion?: number | undefined; - streamingBrainVersion?: number | undefined; - sync?: boolean | undefined; - transcoderActiveVideoSessions?: number | undefined; - transcoderAudio?: boolean | undefined; - transcoderLyrics?: boolean | undefined; - transcoderPhoto?: boolean | undefined; - transcoderSubtitles?: boolean | undefined; - transcoderVideo?: boolean | undefined; - transcoderVideoBitrates?: string | undefined; - transcoderVideoQualities?: string | undefined; - transcoderVideoResolutions?: string | undefined; - updatedAt?: number | undefined; - updater?: boolean | undefined; - version?: string | undefined; - voiceSearch?: boolean | undefined; - Directory?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - allowCameraUpload: z.boolean().optional(), - allowChannelAccess: z.boolean().optional(), - allowMediaDeletion: z.boolean().optional(), - allowSharing: z.boolean().optional(), - allowSync: z.boolean().optional(), - allowTuners: z.boolean().optional(), - backgroundProcessing: z.boolean().optional(), - certificate: z.boolean().optional(), - companionProxy: z.boolean().optional(), - countryCode: z.string().optional(), - diagnostics: z.string().optional(), - eventStream: z.boolean().optional(), - friendlyName: z.string().optional(), - hubSearch: z.boolean().optional(), - itemClusters: z.boolean().optional(), - livetv: z.number().optional(), - machineIdentifier: z.string().optional(), - mediaProviders: z.boolean().optional(), - multiuser: z.boolean().optional(), - musicAnalysis: z.number().optional(), - myPlex: z.boolean().optional(), - myPlexMappingState: z.string().optional(), - myPlexSigninState: z.string().optional(), - myPlexSubscription: z.boolean().optional(), - myPlexUsername: z.string().optional(), - offlineTranscode: z.number().optional(), - ownerFeatures: z.string().optional(), - photoAutoTag: z.boolean().optional(), - platform: z.string().optional(), - platformVersion: z.string().optional(), - pluginHost: z.boolean().optional(), - pushNotifications: z.boolean().optional(), - readOnlyLibraries: z.boolean().optional(), - streamingBrainABRVersion: z.number().optional(), - streamingBrainVersion: z.number().optional(), - sync: z.boolean().optional(), - transcoderActiveVideoSessions: z.number().optional(), - transcoderAudio: z.boolean().optional(), - transcoderLyrics: z.boolean().optional(), - transcoderPhoto: z.boolean().optional(), - transcoderSubtitles: z.boolean().optional(), - transcoderVideo: z.boolean().optional(), - transcoderVideoBitrates: z.string().optional(), - transcoderVideoQualities: z.string().optional(), - transcoderVideoResolutions: z.string().optional(), - updatedAt: z.number().optional(), - updater: z.boolean().optional(), - version: z.string().optional(), - voiceSearch: z.boolean().optional(), - directory: z.array(z.lazy(() => Directory$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - directory: "Directory", - }); - }); -} - -/** @internal */ -export namespace GetServerCapabilitiesResponseBody$ { - export const inboundSchema: z.ZodType< - GetServerCapabilitiesResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - MediaContainer: z.lazy(() => MediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: MediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerCapabilitiesResponseBody - > = z - .object({ - mediaContainer: z.lazy(() => MediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); -} - -/** @internal */ -export namespace GetServerCapabilitiesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetServerCapabilitiesResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetServerCapabilitiesResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetServerCapabilitiesServerResponseBody$outboundSchema: z.ZodType< + GetServerCapabilitiesServerResponseBody$Outbound, + z.ZodTypeDef, + GetServerCapabilitiesServerResponseBody +> = z + .instanceof(GetServerCapabilitiesServerResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetServerCapabilitiesResponseBody$.outboundSchema).optional(), + errors: z.array(z.lazy(() => Errors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerCapabilitiesServerResponseBody$ { + /** @deprecated use `GetServerCapabilitiesServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerCapabilitiesServerResponseBody$inboundSchema; + /** @deprecated use `GetServerCapabilitiesServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerCapabilitiesServerResponseBody$outboundSchema; + /** @deprecated use `GetServerCapabilitiesServerResponseBody$Outbound` instead. */ + export type Outbound = GetServerCapabilitiesServerResponseBody$Outbound; +} + +/** @internal */ +export const Directory$inboundSchema: z.ZodType = z.object({ + count: z.number().optional(), + key: z.string().optional(), + title: z.string().optional(), +}); + +/** @internal */ +export type Directory$Outbound = { + count?: number | undefined; + key?: string | undefined; + title?: string | undefined; +}; + +/** @internal */ +export const Directory$outboundSchema: z.ZodType = + z.object({ + count: z.number().optional(), + key: z.string().optional(), + title: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Directory$ { + /** @deprecated use `Directory$inboundSchema` instead. */ + export const inboundSchema = Directory$inboundSchema; + /** @deprecated use `Directory$outboundSchema` instead. */ + export const outboundSchema = Directory$outboundSchema; + /** @deprecated use `Directory$Outbound` instead. */ + export type Outbound = Directory$Outbound; +} + +/** @internal */ +export const MediaContainer$inboundSchema: z.ZodType = z + .object({ + size: z.number().optional(), + allowCameraUpload: z.boolean().optional(), + allowChannelAccess: z.boolean().optional(), + allowMediaDeletion: z.boolean().optional(), + allowSharing: z.boolean().optional(), + allowSync: z.boolean().optional(), + allowTuners: z.boolean().optional(), + backgroundProcessing: z.boolean().optional(), + certificate: z.boolean().optional(), + companionProxy: z.boolean().optional(), + countryCode: z.string().optional(), + diagnostics: z.string().optional(), + eventStream: z.boolean().optional(), + friendlyName: z.string().optional(), + hubSearch: z.boolean().optional(), + itemClusters: z.boolean().optional(), + livetv: z.number().optional(), + machineIdentifier: z.string().optional(), + mediaProviders: z.boolean().optional(), + multiuser: z.boolean().optional(), + musicAnalysis: z.number().optional(), + myPlex: z.boolean().optional(), + myPlexMappingState: z.string().optional(), + myPlexSigninState: z.string().optional(), + myPlexSubscription: z.boolean().optional(), + myPlexUsername: z.string().optional(), + offlineTranscode: z.number().optional(), + ownerFeatures: z.string().optional(), + photoAutoTag: z.boolean().optional(), + platform: z.string().optional(), + platformVersion: z.string().optional(), + pluginHost: z.boolean().optional(), + pushNotifications: z.boolean().optional(), + readOnlyLibraries: z.boolean().optional(), + streamingBrainABRVersion: z.number().optional(), + streamingBrainVersion: z.number().optional(), + sync: z.boolean().optional(), + transcoderActiveVideoSessions: z.number().optional(), + transcoderAudio: z.boolean().optional(), + transcoderLyrics: z.boolean().optional(), + transcoderPhoto: z.boolean().optional(), + transcoderSubtitles: z.boolean().optional(), + transcoderVideo: z.boolean().optional(), + transcoderVideoBitrates: z.string().optional(), + transcoderVideoQualities: z.string().optional(), + transcoderVideoResolutions: z.string().optional(), + updatedAt: z.number().optional(), + updater: z.boolean().optional(), + version: z.string().optional(), + voiceSearch: z.boolean().optional(), + Directory: z.array(z.lazy(() => Directory$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Directory: "directory", + }); + }); + +/** @internal */ +export type MediaContainer$Outbound = { + size?: number | undefined; + allowCameraUpload?: boolean | undefined; + allowChannelAccess?: boolean | undefined; + allowMediaDeletion?: boolean | undefined; + allowSharing?: boolean | undefined; + allowSync?: boolean | undefined; + allowTuners?: boolean | undefined; + backgroundProcessing?: boolean | undefined; + certificate?: boolean | undefined; + companionProxy?: boolean | undefined; + countryCode?: string | undefined; + diagnostics?: string | undefined; + eventStream?: boolean | undefined; + friendlyName?: string | undefined; + hubSearch?: boolean | undefined; + itemClusters?: boolean | undefined; + livetv?: number | undefined; + machineIdentifier?: string | undefined; + mediaProviders?: boolean | undefined; + multiuser?: boolean | undefined; + musicAnalysis?: number | undefined; + myPlex?: boolean | undefined; + myPlexMappingState?: string | undefined; + myPlexSigninState?: string | undefined; + myPlexSubscription?: boolean | undefined; + myPlexUsername?: string | undefined; + offlineTranscode?: number | undefined; + ownerFeatures?: string | undefined; + photoAutoTag?: boolean | undefined; + platform?: string | undefined; + platformVersion?: string | undefined; + pluginHost?: boolean | undefined; + pushNotifications?: boolean | undefined; + readOnlyLibraries?: boolean | undefined; + streamingBrainABRVersion?: number | undefined; + streamingBrainVersion?: number | undefined; + sync?: boolean | undefined; + transcoderActiveVideoSessions?: number | undefined; + transcoderAudio?: boolean | undefined; + transcoderLyrics?: boolean | undefined; + transcoderPhoto?: boolean | undefined; + transcoderSubtitles?: boolean | undefined; + transcoderVideo?: boolean | undefined; + transcoderVideoBitrates?: string | undefined; + transcoderVideoQualities?: string | undefined; + transcoderVideoResolutions?: string | undefined; + updatedAt?: number | undefined; + updater?: boolean | undefined; + version?: string | undefined; + voiceSearch?: boolean | undefined; + Directory?: Array | undefined; +}; + +/** @internal */ +export const MediaContainer$outboundSchema: z.ZodType< + MediaContainer$Outbound, + z.ZodTypeDef, + MediaContainer +> = z + .object({ + size: z.number().optional(), + allowCameraUpload: z.boolean().optional(), + allowChannelAccess: z.boolean().optional(), + allowMediaDeletion: z.boolean().optional(), + allowSharing: z.boolean().optional(), + allowSync: z.boolean().optional(), + allowTuners: z.boolean().optional(), + backgroundProcessing: z.boolean().optional(), + certificate: z.boolean().optional(), + companionProxy: z.boolean().optional(), + countryCode: z.string().optional(), + diagnostics: z.string().optional(), + eventStream: z.boolean().optional(), + friendlyName: z.string().optional(), + hubSearch: z.boolean().optional(), + itemClusters: z.boolean().optional(), + livetv: z.number().optional(), + machineIdentifier: z.string().optional(), + mediaProviders: z.boolean().optional(), + multiuser: z.boolean().optional(), + musicAnalysis: z.number().optional(), + myPlex: z.boolean().optional(), + myPlexMappingState: z.string().optional(), + myPlexSigninState: z.string().optional(), + myPlexSubscription: z.boolean().optional(), + myPlexUsername: z.string().optional(), + offlineTranscode: z.number().optional(), + ownerFeatures: z.string().optional(), + photoAutoTag: z.boolean().optional(), + platform: z.string().optional(), + platformVersion: z.string().optional(), + pluginHost: z.boolean().optional(), + pushNotifications: z.boolean().optional(), + readOnlyLibraries: z.boolean().optional(), + streamingBrainABRVersion: z.number().optional(), + streamingBrainVersion: z.number().optional(), + sync: z.boolean().optional(), + transcoderActiveVideoSessions: z.number().optional(), + transcoderAudio: z.boolean().optional(), + transcoderLyrics: z.boolean().optional(), + transcoderPhoto: z.boolean().optional(), + transcoderSubtitles: z.boolean().optional(), + transcoderVideo: z.boolean().optional(), + transcoderVideoBitrates: z.string().optional(), + transcoderVideoQualities: z.string().optional(), + transcoderVideoResolutions: z.string().optional(), + updatedAt: z.number().optional(), + updater: z.boolean().optional(), + version: z.string().optional(), + voiceSearch: z.boolean().optional(), + directory: z.array(z.lazy(() => Directory$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + directory: "Directory", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MediaContainer$ { + /** @deprecated use `MediaContainer$inboundSchema` instead. */ + export const inboundSchema = MediaContainer$inboundSchema; + /** @deprecated use `MediaContainer$outboundSchema` instead. */ + export const outboundSchema = MediaContainer$outboundSchema; + /** @deprecated use `MediaContainer$Outbound` instead. */ + export type Outbound = MediaContainer$Outbound; +} + +/** @internal */ +export const GetServerCapabilitiesResponseBody$inboundSchema: z.ZodType< + GetServerCapabilitiesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => MediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetServerCapabilitiesResponseBody$Outbound = { + MediaContainer?: MediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetServerCapabilitiesResponseBody$outboundSchema: z.ZodType< + GetServerCapabilitiesResponseBody$Outbound, + z.ZodTypeDef, + GetServerCapabilitiesResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => MediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerCapabilitiesResponseBody$ { + /** @deprecated use `GetServerCapabilitiesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerCapabilitiesResponseBody$inboundSchema; + /** @deprecated use `GetServerCapabilitiesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerCapabilitiesResponseBody$outboundSchema; + /** @deprecated use `GetServerCapabilitiesResponseBody$Outbound` instead. */ + export type Outbound = GetServerCapabilitiesResponseBody$Outbound; +} + +/** @internal */ +export const GetServerCapabilitiesResponse$inboundSchema: z.ZodType< + GetServerCapabilitiesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetServerCapabilitiesResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetServerCapabilitiesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetServerCapabilitiesResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetServerCapabilitiesResponse$outboundSchema: z.ZodType< + GetServerCapabilitiesResponse$Outbound, + z.ZodTypeDef, + GetServerCapabilitiesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetServerCapabilitiesResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerCapabilitiesResponse$ { + /** @deprecated use `GetServerCapabilitiesResponse$inboundSchema` instead. */ + export const inboundSchema = GetServerCapabilitiesResponse$inboundSchema; + /** @deprecated use `GetServerCapabilitiesResponse$outboundSchema` instead. */ + export const outboundSchema = GetServerCapabilitiesResponse$outboundSchema; + /** @deprecated use `GetServerCapabilitiesResponse$Outbound` instead. */ + export type Outbound = GetServerCapabilitiesResponse$Outbound; } diff --git a/src/models/getserveridentityop.ts b/src/models/getserveridentityop.ts index 19f65718..14109b85 100644 --- a/src/models/getserveridentityop.ts +++ b/src/models/getserveridentityop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetServerIdentityServerResponseBody extends Error { data$: GetServerIdentityServerResponseBodyData; constructor(err: GetServerIdentityServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetServerIdentityServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetServerIdentityServerResponseBody"; } } @@ -89,177 +88,262 @@ export type GetServerIdentityResponse = { }; /** @internal */ +export const GetServerIdentityErrors$inboundSchema: z.ZodType< + GetServerIdentityErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetServerIdentityErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetServerIdentityErrors$outboundSchema: z.ZodType< + GetServerIdentityErrors$Outbound, + z.ZodTypeDef, + GetServerIdentityErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerIdentityErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetServerIdentityErrors$inboundSchema` instead. */ + export const inboundSchema = GetServerIdentityErrors$inboundSchema; + /** @deprecated use `GetServerIdentityErrors$outboundSchema` instead. */ + export const outboundSchema = GetServerIdentityErrors$outboundSchema; + /** @deprecated use `GetServerIdentityErrors$Outbound` instead. */ + export type Outbound = GetServerIdentityErrors$Outbound; } /** @internal */ -export namespace GetServerIdentityServerResponseBody$ { - export const inboundSchema: z.ZodType< - GetServerIdentityServerResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetServerIdentityErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetServerIdentityServerResponseBody(remapped); +export const GetServerIdentityServerResponseBody$inboundSchema: z.ZodType< + GetServerIdentityServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetServerIdentityErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerIdentityServerResponseBody - > = z - .instanceof(GetServerIdentityServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetServerIdentityErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace GetServerIdentityMediaContainer$ { - export const inboundSchema: z.ZodType = - z.object({ - size: z.number().optional(), - claimed: z.boolean().optional(), - machineIdentifier: z.string().optional(), - version: z.string().optional(), - }); - - export type Outbound = { - size?: number | undefined; - claimed?: boolean | undefined; - machineIdentifier?: string | undefined; - version?: string | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerIdentityMediaContainer - > = z.object({ - size: z.number().optional(), - claimed: z.boolean().optional(), - machineIdentifier: z.string().optional(), - version: z.string().optional(), + return new GetServerIdentityServerResponseBody(remapped); }); -} /** @internal */ -export namespace GetServerIdentityResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetServerIdentityMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); +export type GetServerIdentityServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export type Outbound = { - MediaContainer?: GetServerIdentityMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = +/** @internal */ +export const GetServerIdentityServerResponseBody$outboundSchema: z.ZodType< + GetServerIdentityServerResponseBody$Outbound, + z.ZodTypeDef, + GetServerIdentityServerResponseBody +> = z + .instanceof(GetServerIdentityServerResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - mediaContainer: z - .lazy(() => GetServerIdentityMediaContainer$.outboundSchema) + errors: z.array(z.lazy(() => GetServerIdentityErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - mediaContainer: "MediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerIdentityServerResponseBody$ { + /** @deprecated use `GetServerIdentityServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerIdentityServerResponseBody$inboundSchema; + /** @deprecated use `GetServerIdentityServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerIdentityServerResponseBody$outboundSchema; + /** @deprecated use `GetServerIdentityServerResponseBody$Outbound` instead. */ + export type Outbound = GetServerIdentityServerResponseBody$Outbound; } /** @internal */ -export namespace GetServerIdentityResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetServerIdentityResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const GetServerIdentityMediaContainer$inboundSchema: z.ZodType< + GetServerIdentityMediaContainer, + z.ZodTypeDef, + unknown +> = z.object({ + size: z.number().optional(), + claimed: z.boolean().optional(), + machineIdentifier: z.string().optional(), + version: z.string().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetServerIdentityResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type GetServerIdentityMediaContainer$Outbound = { + size?: number | undefined; + claimed?: boolean | undefined; + machineIdentifier?: string | undefined; + version?: string | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetServerIdentityResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const GetServerIdentityMediaContainer$outboundSchema: z.ZodType< + GetServerIdentityMediaContainer$Outbound, + z.ZodTypeDef, + GetServerIdentityMediaContainer +> = z.object({ + size: z.number().optional(), + claimed: z.boolean().optional(), + machineIdentifier: z.string().optional(), + version: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerIdentityMediaContainer$ { + /** @deprecated use `GetServerIdentityMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetServerIdentityMediaContainer$inboundSchema; + /** @deprecated use `GetServerIdentityMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetServerIdentityMediaContainer$outboundSchema; + /** @deprecated use `GetServerIdentityMediaContainer$Outbound` instead. */ + export type Outbound = GetServerIdentityMediaContainer$Outbound; +} + +/** @internal */ +export const GetServerIdentityResponseBody$inboundSchema: z.ZodType< + GetServerIdentityResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetServerIdentityMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetServerIdentityResponseBody$Outbound = { + MediaContainer?: GetServerIdentityMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetServerIdentityResponseBody$outboundSchema: z.ZodType< + GetServerIdentityResponseBody$Outbound, + z.ZodTypeDef, + GetServerIdentityResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetServerIdentityMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerIdentityResponseBody$ { + /** @deprecated use `GetServerIdentityResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerIdentityResponseBody$inboundSchema; + /** @deprecated use `GetServerIdentityResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerIdentityResponseBody$outboundSchema; + /** @deprecated use `GetServerIdentityResponseBody$Outbound` instead. */ + export type Outbound = GetServerIdentityResponseBody$Outbound; +} + +/** @internal */ +export const GetServerIdentityResponse$inboundSchema: z.ZodType< + GetServerIdentityResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetServerIdentityResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetServerIdentityResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetServerIdentityResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetServerIdentityResponse$outboundSchema: z.ZodType< + GetServerIdentityResponse$Outbound, + z.ZodTypeDef, + GetServerIdentityResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetServerIdentityResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerIdentityResponse$ { + /** @deprecated use `GetServerIdentityResponse$inboundSchema` instead. */ + export const inboundSchema = GetServerIdentityResponse$inboundSchema; + /** @deprecated use `GetServerIdentityResponse$outboundSchema` instead. */ + export const outboundSchema = GetServerIdentityResponse$outboundSchema; + /** @deprecated use `GetServerIdentityResponse$Outbound` instead. */ + export type Outbound = GetServerIdentityResponse$Outbound; } diff --git a/src/models/getserverlistop.ts b/src/models/getserverlistop.ts index e7a7e22d..05a787e1 100644 --- a/src/models/getserverlistop.ts +++ b/src/models/getserverlistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetServerListServerResponseBody extends Error { data$: GetServerListServerResponseBodyData; constructor(err: GetServerListServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetServerListServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetServerListServerResponseBody"; } } @@ -96,198 +95,319 @@ export type GetServerListResponse = { }; /** @internal */ +export const GetServerListErrors$inboundSchema: z.ZodType< + GetServerListErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetServerListErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetServerListErrors$outboundSchema: z.ZodType< + GetServerListErrors$Outbound, + z.ZodTypeDef, + GetServerListErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerListErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetServerListErrors$inboundSchema` instead. */ + export const inboundSchema = GetServerListErrors$inboundSchema; + /** @deprecated use `GetServerListErrors$outboundSchema` instead. */ + export const outboundSchema = GetServerListErrors$outboundSchema; + /** @deprecated use `GetServerListErrors$Outbound` instead. */ + export type Outbound = GetServerListErrors$Outbound; } /** @internal */ -export namespace GetServerListServerResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetServerListServerResponseBody$inboundSchema: z.ZodType< + GetServerListServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetServerListErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetServerListServerResponseBody(remapped); + }); + +/** @internal */ +export type GetServerListServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetServerListServerResponseBody$outboundSchema: z.ZodType< + GetServerListServerResponseBody$Outbound, + z.ZodTypeDef, + GetServerListServerResponseBody +> = z + .instanceof(GetServerListServerResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => GetServerListErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => GetServerListErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new GetServerListServerResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerListServerResponseBody - > = z - .instanceof(GetServerListServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetServerListErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerListServerResponseBody$ { + /** @deprecated use `GetServerListServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerListServerResponseBody$inboundSchema; + /** @deprecated use `GetServerListServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerListServerResponseBody$outboundSchema; + /** @deprecated use `GetServerListServerResponseBody$Outbound` instead. */ + export type Outbound = GetServerListServerResponseBody$Outbound; } /** @internal */ +export const GetServerListServer$inboundSchema: z.ZodType< + GetServerListServer, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string().optional(), + host: z.string().optional(), + address: z.string().optional(), + port: z.number().optional(), + machineIdentifier: z.string().optional(), + version: z.string().optional(), +}); + +/** @internal */ +export type GetServerListServer$Outbound = { + name?: string | undefined; + host?: string | undefined; + address?: string | undefined; + port?: number | undefined; + machineIdentifier?: string | undefined; + version?: string | undefined; +}; + +/** @internal */ +export const GetServerListServer$outboundSchema: z.ZodType< + GetServerListServer$Outbound, + z.ZodTypeDef, + GetServerListServer +> = z.object({ + name: z.string().optional(), + host: z.string().optional(), + address: z.string().optional(), + port: z.number().optional(), + machineIdentifier: z.string().optional(), + version: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerListServer$ { - export const inboundSchema: z.ZodType = z.object({ - name: z.string().optional(), - host: z.string().optional(), - address: z.string().optional(), - port: z.number().optional(), - machineIdentifier: z.string().optional(), - version: z.string().optional(), - }); - - export type Outbound = { - name?: string | undefined; - host?: string | undefined; - address?: string | undefined; - port?: number | undefined; - machineIdentifier?: string | undefined; - version?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - name: z.string().optional(), - host: z.string().optional(), - address: z.string().optional(), - port: z.number().optional(), - machineIdentifier: z.string().optional(), - version: z.string().optional(), - }); + /** @deprecated use `GetServerListServer$inboundSchema` instead. */ + export const inboundSchema = GetServerListServer$inboundSchema; + /** @deprecated use `GetServerListServer$outboundSchema` instead. */ + export const outboundSchema = GetServerListServer$outboundSchema; + /** @deprecated use `GetServerListServer$Outbound` instead. */ + export type Outbound = GetServerListServer$Outbound; } /** @internal */ +export const GetServerListMediaContainer$inboundSchema: z.ZodType< + GetServerListMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().optional(), + Server: z.array(z.lazy(() => GetServerListServer$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Server: "server", + }); + }); + +/** @internal */ +export type GetServerListMediaContainer$Outbound = { + size?: number | undefined; + Server?: Array | undefined; +}; + +/** @internal */ +export const GetServerListMediaContainer$outboundSchema: z.ZodType< + GetServerListMediaContainer$Outbound, + z.ZodTypeDef, + GetServerListMediaContainer +> = z + .object({ + size: z.number().optional(), + server: z.array(z.lazy(() => GetServerListServer$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + server: "Server", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerListMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - Server: z.array(z.lazy(() => GetServerListServer$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Server: "server", - }); - }); - - export type Outbound = { - size?: number | undefined; - Server?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().optional(), - server: z.array(z.lazy(() => GetServerListServer$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - server: "Server", - }); - }); + /** @deprecated use `GetServerListMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetServerListMediaContainer$inboundSchema; + /** @deprecated use `GetServerListMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetServerListMediaContainer$outboundSchema; + /** @deprecated use `GetServerListMediaContainer$Outbound` instead. */ + export type Outbound = GetServerListMediaContainer$Outbound; } /** @internal */ +export const GetServerListResponseBody$inboundSchema: z.ZodType< + GetServerListResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetServerListMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetServerListResponseBody$Outbound = { + MediaContainer?: GetServerListMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetServerListResponseBody$outboundSchema: z.ZodType< + GetServerListResponseBody$Outbound, + z.ZodTypeDef, + GetServerListResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetServerListMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerListResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetServerListMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetServerListMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetServerListMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetServerListResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerListResponseBody$inboundSchema; + /** @deprecated use `GetServerListResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerListResponseBody$outboundSchema; + /** @deprecated use `GetServerListResponseBody$Outbound` instead. */ + export type Outbound = GetServerListResponseBody$Outbound; } /** @internal */ +export const GetServerListResponse$inboundSchema: z.ZodType< + GetServerListResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetServerListResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetServerListResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetServerListResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetServerListResponse$outboundSchema: z.ZodType< + GetServerListResponse$Outbound, + z.ZodTypeDef, + GetServerListResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetServerListResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerListResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetServerListResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetServerListResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetServerListResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetServerListResponse$inboundSchema` instead. */ + export const inboundSchema = GetServerListResponse$inboundSchema; + /** @deprecated use `GetServerListResponse$outboundSchema` instead. */ + export const outboundSchema = GetServerListResponse$outboundSchema; + /** @deprecated use `GetServerListResponse$Outbound` instead. */ + export type Outbound = GetServerListResponse$Outbound; } diff --git a/src/models/getserverpreferencesop.ts b/src/models/getserverpreferencesop.ts index a5a91d27..ef565559 100644 --- a/src/models/getserverpreferencesop.ts +++ b/src/models/getserverpreferencesop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetServerPreferencesServerResponseBody extends Error { data$: GetServerPreferencesServerResponseBodyData; constructor(err: GetServerPreferencesServerResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetServerPreferencesServerResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetServerPreferencesServerResponseBody"; } } @@ -100,234 +99,323 @@ export type GetServerPreferencesResponse = { }; /** @internal */ +export const GetServerPreferencesErrors$inboundSchema: z.ZodType< + GetServerPreferencesErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetServerPreferencesErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetServerPreferencesErrors$outboundSchema: z.ZodType< + GetServerPreferencesErrors$Outbound, + z.ZodTypeDef, + GetServerPreferencesErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetServerPreferencesErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetServerPreferencesErrors$inboundSchema` instead. */ + export const inboundSchema = GetServerPreferencesErrors$inboundSchema; + /** @deprecated use `GetServerPreferencesErrors$outboundSchema` instead. */ + export const outboundSchema = GetServerPreferencesErrors$outboundSchema; + /** @deprecated use `GetServerPreferencesErrors$Outbound` instead. */ + export type Outbound = GetServerPreferencesErrors$Outbound; } /** @internal */ -export namespace GetServerPreferencesServerResponseBody$ { - export const inboundSchema: z.ZodType< - GetServerPreferencesServerResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetServerPreferencesErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetServerPreferencesServerResponseBody(remapped); +export const GetServerPreferencesServerResponseBody$inboundSchema: z.ZodType< + GetServerPreferencesServerResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetServerPreferencesErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerPreferencesServerResponseBody - > = z - .instanceof(GetServerPreferencesServerResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetServerPreferencesErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace Setting$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - label: z.string().optional(), - summary: z.string().optional(), - type: z.string().optional(), - default: z.boolean().optional(), - value: z.boolean().optional(), - hidden: z.boolean().optional(), - advanced: z.boolean().optional(), - group: z.string().optional(), - enumValues: z.string().optional(), + return new GetServerPreferencesServerResponseBody(remapped); }); - export type Outbound = { - id?: string | undefined; - label?: string | undefined; - summary?: string | undefined; - type?: string | undefined; - default?: boolean | undefined; - value?: boolean | undefined; - hidden?: boolean | undefined; - advanced?: boolean | undefined; - group?: string | undefined; - enumValues?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - label: z.string().optional(), - summary: z.string().optional(), - type: z.string().optional(), - default: z.boolean().optional(), - value: z.boolean().optional(), - hidden: z.boolean().optional(), - advanced: z.boolean().optional(), - group: z.string().optional(), - enumValues: z.string().optional(), - }); -} +/** @internal */ +export type GetServerPreferencesServerResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetServerPreferencesMediaContainer$ { - export const inboundSchema: z.ZodType< - GetServerPreferencesMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - Setting: z.array(z.lazy(() => Setting$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Setting: "setting", - }); - }); - - export type Outbound = { - size?: number | undefined; - Setting?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerPreferencesMediaContainer - > = z - .object({ - size: z.number().int().optional(), - setting: z.array(z.lazy(() => Setting$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - setting: "Setting", - }); - }); -} - -/** @internal */ -export namespace GetServerPreferencesResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetServerPreferencesServerResponseBody$outboundSchema: z.ZodType< + GetServerPreferencesServerResponseBody$Outbound, + z.ZodTypeDef, + GetServerPreferencesServerResponseBody +> = z + .instanceof(GetServerPreferencesServerResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => GetServerPreferencesMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => GetServerPreferencesErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: GetServerPreferencesMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetServerPreferencesResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetServerPreferencesMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerPreferencesServerResponseBody$ { + /** @deprecated use `GetServerPreferencesServerResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerPreferencesServerResponseBody$inboundSchema; + /** @deprecated use `GetServerPreferencesServerResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerPreferencesServerResponseBody$outboundSchema; + /** @deprecated use `GetServerPreferencesServerResponseBody$Outbound` instead. */ + export type Outbound = GetServerPreferencesServerResponseBody$Outbound; } /** @internal */ -export namespace GetServerPreferencesResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetServerPreferencesResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const Setting$inboundSchema: z.ZodType = z.object({ + id: z.string().optional(), + label: z.string().optional(), + summary: z.string().optional(), + type: z.string().optional(), + default: z.boolean().optional(), + value: z.boolean().optional(), + hidden: z.boolean().optional(), + advanced: z.boolean().optional(), + group: z.string().optional(), + enumValues: z.string().optional(), +}); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetServerPreferencesResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type Setting$Outbound = { + id?: string | undefined; + label?: string | undefined; + summary?: string | undefined; + type?: string | undefined; + default?: boolean | undefined; + value?: boolean | undefined; + hidden?: boolean | undefined; + advanced?: boolean | undefined; + group?: string | undefined; + enumValues?: string | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetServerPreferencesResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const Setting$outboundSchema: z.ZodType = z.object({ + id: z.string().optional(), + label: z.string().optional(), + summary: z.string().optional(), + type: z.string().optional(), + default: z.boolean().optional(), + value: z.boolean().optional(), + hidden: z.boolean().optional(), + advanced: z.boolean().optional(), + group: z.string().optional(), + enumValues: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Setting$ { + /** @deprecated use `Setting$inboundSchema` instead. */ + export const inboundSchema = Setting$inboundSchema; + /** @deprecated use `Setting$outboundSchema` instead. */ + export const outboundSchema = Setting$outboundSchema; + /** @deprecated use `Setting$Outbound` instead. */ + export type Outbound = Setting$Outbound; +} + +/** @internal */ +export const GetServerPreferencesMediaContainer$inboundSchema: z.ZodType< + GetServerPreferencesMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Setting: z.array(z.lazy(() => Setting$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Setting: "setting", + }); + }); + +/** @internal */ +export type GetServerPreferencesMediaContainer$Outbound = { + size?: number | undefined; + Setting?: Array | undefined; +}; + +/** @internal */ +export const GetServerPreferencesMediaContainer$outboundSchema: z.ZodType< + GetServerPreferencesMediaContainer$Outbound, + z.ZodTypeDef, + GetServerPreferencesMediaContainer +> = z + .object({ + size: z.number().int().optional(), + setting: z.array(z.lazy(() => Setting$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + setting: "Setting", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerPreferencesMediaContainer$ { + /** @deprecated use `GetServerPreferencesMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetServerPreferencesMediaContainer$inboundSchema; + /** @deprecated use `GetServerPreferencesMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetServerPreferencesMediaContainer$outboundSchema; + /** @deprecated use `GetServerPreferencesMediaContainer$Outbound` instead. */ + export type Outbound = GetServerPreferencesMediaContainer$Outbound; +} + +/** @internal */ +export const GetServerPreferencesResponseBody$inboundSchema: z.ZodType< + GetServerPreferencesResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetServerPreferencesMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetServerPreferencesResponseBody$Outbound = { + MediaContainer?: GetServerPreferencesMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetServerPreferencesResponseBody$outboundSchema: z.ZodType< + GetServerPreferencesResponseBody$Outbound, + z.ZodTypeDef, + GetServerPreferencesResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetServerPreferencesMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerPreferencesResponseBody$ { + /** @deprecated use `GetServerPreferencesResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetServerPreferencesResponseBody$inboundSchema; + /** @deprecated use `GetServerPreferencesResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetServerPreferencesResponseBody$outboundSchema; + /** @deprecated use `GetServerPreferencesResponseBody$Outbound` instead. */ + export type Outbound = GetServerPreferencesResponseBody$Outbound; +} + +/** @internal */ +export const GetServerPreferencesResponse$inboundSchema: z.ZodType< + GetServerPreferencesResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetServerPreferencesResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetServerPreferencesResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetServerPreferencesResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetServerPreferencesResponse$outboundSchema: z.ZodType< + GetServerPreferencesResponse$Outbound, + z.ZodTypeDef, + GetServerPreferencesResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetServerPreferencesResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetServerPreferencesResponse$ { + /** @deprecated use `GetServerPreferencesResponse$inboundSchema` instead. */ + export const inboundSchema = GetServerPreferencesResponse$inboundSchema; + /** @deprecated use `GetServerPreferencesResponse$outboundSchema` instead. */ + export const outboundSchema = GetServerPreferencesResponse$outboundSchema; + /** @deprecated use `GetServerPreferencesResponse$Outbound` instead. */ + export type Outbound = GetServerPreferencesResponse$Outbound; } diff --git a/src/models/getsessionhistoryop.ts b/src/models/getsessionhistoryop.ts index e3d9bbc5..725bc099 100644 --- a/src/models/getsessionhistoryop.ts +++ b/src/models/getsessionhistoryop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -78,7 +78,11 @@ export class GetSessionHistorySessionsResponseBody extends Error { data$: GetSessionHistorySessionsResponseBodyData; constructor(err: GetSessionHistorySessionsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -88,11 +92,6 @@ export class GetSessionHistorySessionsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetSessionHistorySessionsResponseBody"; } } @@ -151,297 +150,431 @@ export type GetSessionHistoryResponse = { }; /** @internal */ +export const Filter$inboundSchema: z.ZodType = z.object({}); + +/** @internal */ +export type Filter$Outbound = {}; + +/** @internal */ +export const Filter$outboundSchema: z.ZodType = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Filter$ { - export const inboundSchema: z.ZodType = z.object({}); - - export type Outbound = {}; - - export const outboundSchema: z.ZodType = z.object({}); + /** @deprecated use `Filter$inboundSchema` instead. */ + export const inboundSchema = Filter$inboundSchema; + /** @deprecated use `Filter$outboundSchema` instead. */ + export const outboundSchema = Filter$outboundSchema; + /** @deprecated use `Filter$Outbound` instead. */ + export type Outbound = Filter$Outbound; } /** @internal */ +export const GetSessionHistoryRequest$inboundSchema: z.ZodType< + GetSessionHistoryRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sort: z.string().optional(), + accountId: z.number().int().optional(), + filter: z.lazy(() => Filter$inboundSchema).optional(), + librarySectionID: z.number().int().optional(), +}); + +/** @internal */ +export type GetSessionHistoryRequest$Outbound = { + sort?: string | undefined; + accountId?: number | undefined; + filter?: Filter$Outbound | undefined; + librarySectionID?: number | undefined; +}; + +/** @internal */ +export const GetSessionHistoryRequest$outboundSchema: z.ZodType< + GetSessionHistoryRequest$Outbound, + z.ZodTypeDef, + GetSessionHistoryRequest +> = z.object({ + sort: z.string().optional(), + accountId: z.number().int().optional(), + filter: z.lazy(() => Filter$outboundSchema).optional(), + librarySectionID: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistoryRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - sort: z.string().optional(), - accountId: z.number().int().optional(), - filter: z.lazy(() => Filter$.inboundSchema).optional(), - librarySectionID: z.number().int().optional(), - }); - - export type Outbound = { - sort?: string | undefined; - accountId?: number | undefined; - filter?: Filter$.Outbound | undefined; - librarySectionID?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - sort: z.string().optional(), - accountId: z.number().int().optional(), - filter: z.lazy(() => Filter$.outboundSchema).optional(), - librarySectionID: z.number().int().optional(), - }); + /** @deprecated use `GetSessionHistoryRequest$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistoryRequest$inboundSchema; + /** @deprecated use `GetSessionHistoryRequest$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistoryRequest$outboundSchema; + /** @deprecated use `GetSessionHistoryRequest$Outbound` instead. */ + export type Outbound = GetSessionHistoryRequest$Outbound; } /** @internal */ +export const GetSessionHistoryErrors$inboundSchema: z.ZodType< + GetSessionHistoryErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetSessionHistoryErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetSessionHistoryErrors$outboundSchema: z.ZodType< + GetSessionHistoryErrors$Outbound, + z.ZodTypeDef, + GetSessionHistoryErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistoryErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetSessionHistoryErrors$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistoryErrors$inboundSchema; + /** @deprecated use `GetSessionHistoryErrors$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistoryErrors$outboundSchema; + /** @deprecated use `GetSessionHistoryErrors$Outbound` instead. */ + export type Outbound = GetSessionHistoryErrors$Outbound; } /** @internal */ +export const GetSessionHistorySessionsResponseBody$inboundSchema: z.ZodType< + GetSessionHistorySessionsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetSessionHistoryErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetSessionHistorySessionsResponseBody(remapped); + }); + +/** @internal */ +export type GetSessionHistorySessionsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetSessionHistorySessionsResponseBody$outboundSchema: z.ZodType< + GetSessionHistorySessionsResponseBody$Outbound, + z.ZodTypeDef, + GetSessionHistorySessionsResponseBody +> = z + .instanceof(GetSessionHistorySessionsResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetSessionHistoryErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistorySessionsResponseBody$ { - export const inboundSchema: z.ZodType< - GetSessionHistorySessionsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetSessionHistoryErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetSessionHistorySessionsResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSessionHistorySessionsResponseBody - > = z - .instanceof(GetSessionHistorySessionsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetSessionHistoryErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetSessionHistorySessionsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistorySessionsResponseBody$inboundSchema; + /** @deprecated use `GetSessionHistorySessionsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistorySessionsResponseBody$outboundSchema; + /** @deprecated use `GetSessionHistorySessionsResponseBody$Outbound` instead. */ + export type Outbound = GetSessionHistorySessionsResponseBody$Outbound; } /** @internal */ +export const GetSessionHistoryMetadata$inboundSchema: z.ZodType< + GetSessionHistoryMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + historyKey: z.string().optional(), + key: z.string().optional(), + ratingKey: z.string().optional(), + librarySectionID: z.string().optional(), + parentKey: z.string().optional(), + grandparentKey: z.string().optional(), + title: z.string().optional(), + grandparentTitle: z.string().optional(), + type: z.string().optional(), + thumb: z.string().optional(), + parentThumb: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentArt: z.string().optional(), + index: z.number().int().optional(), + parentIndex: z.number().int().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + viewedAt: z.number().int().optional(), + accountID: z.number().int().optional(), + deviceID: z.number().int().optional(), +}); + +/** @internal */ +export type GetSessionHistoryMetadata$Outbound = { + historyKey?: string | undefined; + key?: string | undefined; + ratingKey?: string | undefined; + librarySectionID?: string | undefined; + parentKey?: string | undefined; + grandparentKey?: string | undefined; + title?: string | undefined; + grandparentTitle?: string | undefined; + type?: string | undefined; + thumb?: string | undefined; + parentThumb?: string | undefined; + grandparentThumb?: string | undefined; + grandparentArt?: string | undefined; + index?: number | undefined; + parentIndex?: number | undefined; + originallyAvailableAt?: string | undefined; + viewedAt?: number | undefined; + accountID?: number | undefined; + deviceID?: number | undefined; +}; + +/** @internal */ +export const GetSessionHistoryMetadata$outboundSchema: z.ZodType< + GetSessionHistoryMetadata$Outbound, + z.ZodTypeDef, + GetSessionHistoryMetadata +> = z.object({ + historyKey: z.string().optional(), + key: z.string().optional(), + ratingKey: z.string().optional(), + librarySectionID: z.string().optional(), + parentKey: z.string().optional(), + grandparentKey: z.string().optional(), + title: z.string().optional(), + grandparentTitle: z.string().optional(), + type: z.string().optional(), + thumb: z.string().optional(), + parentThumb: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentArt: z.string().optional(), + index: z.number().int().optional(), + parentIndex: z.number().int().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + viewedAt: z.number().int().optional(), + accountID: z.number().int().optional(), + deviceID: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistoryMetadata$ { - export const inboundSchema: z.ZodType = - z.object({ - historyKey: z.string().optional(), - key: z.string().optional(), - ratingKey: z.string().optional(), - librarySectionID: z.string().optional(), - parentKey: z.string().optional(), - grandparentKey: z.string().optional(), - title: z.string().optional(), - grandparentTitle: z.string().optional(), - type: z.string().optional(), - thumb: z.string().optional(), - parentThumb: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentArt: z.string().optional(), - index: z.number().int().optional(), - parentIndex: z.number().int().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - viewedAt: z.number().int().optional(), - accountID: z.number().int().optional(), - deviceID: z.number().int().optional(), - }); - - export type Outbound = { - historyKey?: string | undefined; - key?: string | undefined; - ratingKey?: string | undefined; - librarySectionID?: string | undefined; - parentKey?: string | undefined; - grandparentKey?: string | undefined; - title?: string | undefined; - grandparentTitle?: string | undefined; - type?: string | undefined; - thumb?: string | undefined; - parentThumb?: string | undefined; - grandparentThumb?: string | undefined; - grandparentArt?: string | undefined; - index?: number | undefined; - parentIndex?: number | undefined; - originallyAvailableAt?: string | undefined; - viewedAt?: number | undefined; - accountID?: number | undefined; - deviceID?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - historyKey: z.string().optional(), - key: z.string().optional(), - ratingKey: z.string().optional(), - librarySectionID: z.string().optional(), - parentKey: z.string().optional(), - grandparentKey: z.string().optional(), - title: z.string().optional(), - grandparentTitle: z.string().optional(), - type: z.string().optional(), - thumb: z.string().optional(), - parentThumb: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentArt: z.string().optional(), - index: z.number().int().optional(), - parentIndex: z.number().int().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - viewedAt: z.number().int().optional(), - accountID: z.number().int().optional(), - deviceID: z.number().int().optional(), - }); + /** @deprecated use `GetSessionHistoryMetadata$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistoryMetadata$inboundSchema; + /** @deprecated use `GetSessionHistoryMetadata$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistoryMetadata$outboundSchema; + /** @deprecated use `GetSessionHistoryMetadata$Outbound` instead. */ + export type Outbound = GetSessionHistoryMetadata$Outbound; } /** @internal */ +export const GetSessionHistoryMediaContainer$inboundSchema: z.ZodType< + GetSessionHistoryMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Metadata: z.array(z.lazy(() => GetSessionHistoryMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetSessionHistoryMediaContainer$Outbound = { + size?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetSessionHistoryMediaContainer$outboundSchema: z.ZodType< + GetSessionHistoryMediaContainer$Outbound, + z.ZodTypeDef, + GetSessionHistoryMediaContainer +> = z + .object({ + size: z.number().int().optional(), + metadata: z.array(z.lazy(() => GetSessionHistoryMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistoryMediaContainer$ { - export const inboundSchema: z.ZodType = - z - .object({ - size: z.number().int().optional(), - Metadata: z - .array(z.lazy(() => GetSessionHistoryMetadata$.inboundSchema)) - .optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSessionHistoryMediaContainer - > = z - .object({ - size: z.number().int().optional(), - metadata: z.array(z.lazy(() => GetSessionHistoryMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetSessionHistoryMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistoryMediaContainer$inboundSchema; + /** @deprecated use `GetSessionHistoryMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistoryMediaContainer$outboundSchema; + /** @deprecated use `GetSessionHistoryMediaContainer$Outbound` instead. */ + export type Outbound = GetSessionHistoryMediaContainer$Outbound; } /** @internal */ +export const GetSessionHistoryResponseBody$inboundSchema: z.ZodType< + GetSessionHistoryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetSessionHistoryMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetSessionHistoryResponseBody$Outbound = { + MediaContainer?: GetSessionHistoryMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetSessionHistoryResponseBody$outboundSchema: z.ZodType< + GetSessionHistoryResponseBody$Outbound, + z.ZodTypeDef, + GetSessionHistoryResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetSessionHistoryMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistoryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetSessionHistoryMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetSessionHistoryMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = - z - .object({ - mediaContainer: z - .lazy(() => GetSessionHistoryMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetSessionHistoryResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistoryResponseBody$inboundSchema; + /** @deprecated use `GetSessionHistoryResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistoryResponseBody$outboundSchema; + /** @deprecated use `GetSessionHistoryResponseBody$Outbound` instead. */ + export type Outbound = GetSessionHistoryResponseBody$Outbound; } /** @internal */ +export const GetSessionHistoryResponse$inboundSchema: z.ZodType< + GetSessionHistoryResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetSessionHistoryResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetSessionHistoryResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetSessionHistoryResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetSessionHistoryResponse$outboundSchema: z.ZodType< + GetSessionHistoryResponse$Outbound, + z.ZodTypeDef, + GetSessionHistoryResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetSessionHistoryResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionHistoryResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetSessionHistoryResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetSessionHistoryResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetSessionHistoryResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetSessionHistoryResponse$inboundSchema` instead. */ + export const inboundSchema = GetSessionHistoryResponse$inboundSchema; + /** @deprecated use `GetSessionHistoryResponse$outboundSchema` instead. */ + export const outboundSchema = GetSessionHistoryResponse$outboundSchema; + /** @deprecated use `GetSessionHistoryResponse$Outbound` instead. */ + export type Outbound = GetSessionHistoryResponse$Outbound; } diff --git a/src/models/getsessionsop.ts b/src/models/getsessionsop.ts index 0d79cedd..a1a586ab 100644 --- a/src/models/getsessionsop.ts +++ b/src/models/getsessionsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetSessionsSessionsResponseBody extends Error { data$: GetSessionsSessionsResponseBodyData; constructor(err: GetSessionsSessionsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetSessionsSessionsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetSessionsSessionsResponseBody"; } } @@ -204,582 +203,796 @@ export type GetSessionsResponse = { }; /** @internal */ +export const GetSessionsErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetSessionsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetSessionsErrors$outboundSchema: z.ZodType< + GetSessionsErrors$Outbound, + z.ZodTypeDef, + GetSessionsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetSessionsErrors$inboundSchema` instead. */ + export const inboundSchema = GetSessionsErrors$inboundSchema; + /** @deprecated use `GetSessionsErrors$outboundSchema` instead. */ + export const outboundSchema = GetSessionsErrors$outboundSchema; + /** @deprecated use `GetSessionsErrors$Outbound` instead. */ + export type Outbound = GetSessionsErrors$Outbound; } /** @internal */ -export namespace GetSessionsSessionsResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetSessionsSessionsResponseBody$inboundSchema: z.ZodType< + GetSessionsSessionsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetSessionsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetSessionsSessionsResponseBody(remapped); + }); + +/** @internal */ +export type GetSessionsSessionsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetSessionsSessionsResponseBody$outboundSchema: z.ZodType< + GetSessionsSessionsResponseBody$Outbound, + z.ZodTypeDef, + GetSessionsSessionsResponseBody +> = z + .instanceof(GetSessionsSessionsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => GetSessionsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => GetSessionsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new GetSessionsSessionsResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSessionsSessionsResponseBody - > = z - .instanceof(GetSessionsSessionsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetSessionsErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSessionsSessionsResponseBody$ { + /** @deprecated use `GetSessionsSessionsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSessionsSessionsResponseBody$inboundSchema; + /** @deprecated use `GetSessionsSessionsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSessionsSessionsResponseBody$outboundSchema; + /** @deprecated use `GetSessionsSessionsResponseBody$Outbound` instead. */ + export type Outbound = GetSessionsSessionsResponseBody$Outbound; } /** @internal */ +export const GetSessionsStream$inboundSchema: z.ZodType = + z.object({ + albumGain: z.string().optional(), + albumPeak: z.string().optional(), + albumRange: z.string().optional(), + audioChannelLayout: z.string().optional(), + bitDepth: z.number().int().optional(), + bitrate: z.number().int().optional(), + channels: z.number().int().optional(), + codec: z.string().optional(), + displayTitle: z.string().optional(), + extendedDisplayTitle: z.string().optional(), + gain: z.string().optional(), + id: z.string().optional(), + index: z.number().int().optional(), + loudness: z.string().optional(), + lra: z.string().optional(), + peak: z.string().optional(), + samplingRate: z.number().int().optional(), + selected: z.boolean().optional(), + streamType: z.number().int().optional(), + location: z.string().optional(), + }); + +/** @internal */ +export type GetSessionsStream$Outbound = { + albumGain?: string | undefined; + albumPeak?: string | undefined; + albumRange?: string | undefined; + audioChannelLayout?: string | undefined; + bitDepth?: number | undefined; + bitrate?: number | undefined; + channels?: number | undefined; + codec?: string | undefined; + displayTitle?: string | undefined; + extendedDisplayTitle?: string | undefined; + gain?: string | undefined; + id?: string | undefined; + index?: number | undefined; + loudness?: string | undefined; + lra?: string | undefined; + peak?: string | undefined; + samplingRate?: number | undefined; + selected?: boolean | undefined; + streamType?: number | undefined; + location?: string | undefined; +}; + +/** @internal */ +export const GetSessionsStream$outboundSchema: z.ZodType< + GetSessionsStream$Outbound, + z.ZodTypeDef, + GetSessionsStream +> = z.object({ + albumGain: z.string().optional(), + albumPeak: z.string().optional(), + albumRange: z.string().optional(), + audioChannelLayout: z.string().optional(), + bitDepth: z.number().int().optional(), + bitrate: z.number().int().optional(), + channels: z.number().int().optional(), + codec: z.string().optional(), + displayTitle: z.string().optional(), + extendedDisplayTitle: z.string().optional(), + gain: z.string().optional(), + id: z.string().optional(), + index: z.number().int().optional(), + loudness: z.string().optional(), + lra: z.string().optional(), + peak: z.string().optional(), + samplingRate: z.number().int().optional(), + selected: z.boolean().optional(), + streamType: z.number().int().optional(), + location: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsStream$ { - export const inboundSchema: z.ZodType = z.object({ - albumGain: z.string().optional(), - albumPeak: z.string().optional(), - albumRange: z.string().optional(), - audioChannelLayout: z.string().optional(), - bitDepth: z.number().int().optional(), - bitrate: z.number().int().optional(), - channels: z.number().int().optional(), - codec: z.string().optional(), - displayTitle: z.string().optional(), - extendedDisplayTitle: z.string().optional(), - gain: z.string().optional(), - id: z.string().optional(), - index: z.number().int().optional(), - loudness: z.string().optional(), - lra: z.string().optional(), - peak: z.string().optional(), - samplingRate: z.number().int().optional(), - selected: z.boolean().optional(), - streamType: z.number().int().optional(), - location: z.string().optional(), - }); - - export type Outbound = { - albumGain?: string | undefined; - albumPeak?: string | undefined; - albumRange?: string | undefined; - audioChannelLayout?: string | undefined; - bitDepth?: number | undefined; - bitrate?: number | undefined; - channels?: number | undefined; - codec?: string | undefined; - displayTitle?: string | undefined; - extendedDisplayTitle?: string | undefined; - gain?: string | undefined; - id?: string | undefined; - index?: number | undefined; - loudness?: string | undefined; - lra?: string | undefined; - peak?: string | undefined; - samplingRate?: number | undefined; - selected?: boolean | undefined; - streamType?: number | undefined; - location?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - albumGain: z.string().optional(), - albumPeak: z.string().optional(), - albumRange: z.string().optional(), - audioChannelLayout: z.string().optional(), - bitDepth: z.number().int().optional(), - bitrate: z.number().int().optional(), - channels: z.number().int().optional(), - codec: z.string().optional(), - displayTitle: z.string().optional(), - extendedDisplayTitle: z.string().optional(), - gain: z.string().optional(), - id: z.string().optional(), - index: z.number().int().optional(), - loudness: z.string().optional(), - lra: z.string().optional(), - peak: z.string().optional(), - samplingRate: z.number().int().optional(), - selected: z.boolean().optional(), - streamType: z.number().int().optional(), - location: z.string().optional(), - }); + /** @deprecated use `GetSessionsStream$inboundSchema` instead. */ + export const inboundSchema = GetSessionsStream$inboundSchema; + /** @deprecated use `GetSessionsStream$outboundSchema` instead. */ + export const outboundSchema = GetSessionsStream$outboundSchema; + /** @deprecated use `GetSessionsStream$Outbound` instead. */ + export type Outbound = GetSessionsStream$Outbound; } /** @internal */ +export const GetSessionsPart$inboundSchema: z.ZodType = z + .object({ + container: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + hasThumbnail: z.string().optional(), + id: z.string().optional(), + key: z.string().optional(), + size: z.number().int().optional(), + decision: z.string().optional(), + selected: z.boolean().optional(), + Stream: z.array(z.lazy(() => GetSessionsStream$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Stream: "stream", + }); + }); + +/** @internal */ +export type GetSessionsPart$Outbound = { + container?: string | undefined; + duration?: number | undefined; + file?: string | undefined; + hasThumbnail?: string | undefined; + id?: string | undefined; + key?: string | undefined; + size?: number | undefined; + decision?: string | undefined; + selected?: boolean | undefined; + Stream?: Array | undefined; +}; + +/** @internal */ +export const GetSessionsPart$outboundSchema: z.ZodType< + GetSessionsPart$Outbound, + z.ZodTypeDef, + GetSessionsPart +> = z + .object({ + container: z.string().optional(), + duration: z.number().int().optional(), + file: z.string().optional(), + hasThumbnail: z.string().optional(), + id: z.string().optional(), + key: z.string().optional(), + size: z.number().int().optional(), + decision: z.string().optional(), + selected: z.boolean().optional(), + stream: z.array(z.lazy(() => GetSessionsStream$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + stream: "Stream", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsPart$ { - export const inboundSchema: z.ZodType = z - .object({ - container: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - hasThumbnail: z.string().optional(), - id: z.string().optional(), - key: z.string().optional(), - size: z.number().int().optional(), - decision: z.string().optional(), - selected: z.boolean().optional(), - Stream: z.array(z.lazy(() => GetSessionsStream$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Stream: "stream", - }); - }); - - export type Outbound = { - container?: string | undefined; - duration?: number | undefined; - file?: string | undefined; - hasThumbnail?: string | undefined; - id?: string | undefined; - key?: string | undefined; - size?: number | undefined; - decision?: string | undefined; - selected?: boolean | undefined; - Stream?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - container: z.string().optional(), - duration: z.number().int().optional(), - file: z.string().optional(), - hasThumbnail: z.string().optional(), - id: z.string().optional(), - key: z.string().optional(), - size: z.number().int().optional(), - decision: z.string().optional(), - selected: z.boolean().optional(), - stream: z.array(z.lazy(() => GetSessionsStream$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - stream: "Stream", - }); - }); + /** @deprecated use `GetSessionsPart$inboundSchema` instead. */ + export const inboundSchema = GetSessionsPart$inboundSchema; + /** @deprecated use `GetSessionsPart$outboundSchema` instead. */ + export const outboundSchema = GetSessionsPart$outboundSchema; + /** @deprecated use `GetSessionsPart$Outbound` instead. */ + export type Outbound = GetSessionsPart$Outbound; } /** @internal */ +export const GetSessionsMedia$inboundSchema: z.ZodType = z + .object({ + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + bitrate: z.number().int().optional(), + container: z.string().optional(), + duration: z.number().int().optional(), + id: z.string().optional(), + selected: z.boolean().optional(), + Part: z.array(z.lazy(() => GetSessionsPart$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Part: "part", + }); + }); + +/** @internal */ +export type GetSessionsMedia$Outbound = { + audioChannels?: number | undefined; + audioCodec?: string | undefined; + bitrate?: number | undefined; + container?: string | undefined; + duration?: number | undefined; + id?: string | undefined; + selected?: boolean | undefined; + Part?: Array | undefined; +}; + +/** @internal */ +export const GetSessionsMedia$outboundSchema: z.ZodType< + GetSessionsMedia$Outbound, + z.ZodTypeDef, + GetSessionsMedia +> = z + .object({ + audioChannels: z.number().int().optional(), + audioCodec: z.string().optional(), + bitrate: z.number().int().optional(), + container: z.string().optional(), + duration: z.number().int().optional(), + id: z.string().optional(), + selected: z.boolean().optional(), + part: z.array(z.lazy(() => GetSessionsPart$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + part: "Part", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsMedia$ { - export const inboundSchema: z.ZodType = z - .object({ - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - bitrate: z.number().int().optional(), - container: z.string().optional(), - duration: z.number().int().optional(), - id: z.string().optional(), - selected: z.boolean().optional(), - Part: z.array(z.lazy(() => GetSessionsPart$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Part: "part", - }); - }); - - export type Outbound = { - audioChannels?: number | undefined; - audioCodec?: string | undefined; - bitrate?: number | undefined; - container?: string | undefined; - duration?: number | undefined; - id?: string | undefined; - selected?: boolean | undefined; - Part?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - audioChannels: z.number().int().optional(), - audioCodec: z.string().optional(), - bitrate: z.number().int().optional(), - container: z.string().optional(), - duration: z.number().int().optional(), - id: z.string().optional(), - selected: z.boolean().optional(), - part: z.array(z.lazy(() => GetSessionsPart$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - part: "Part", - }); - }); + /** @deprecated use `GetSessionsMedia$inboundSchema` instead. */ + export const inboundSchema = GetSessionsMedia$inboundSchema; + /** @deprecated use `GetSessionsMedia$outboundSchema` instead. */ + export const outboundSchema = GetSessionsMedia$outboundSchema; + /** @deprecated use `GetSessionsMedia$Outbound` instead. */ + export type Outbound = GetSessionsMedia$Outbound; } /** @internal */ +export const GetSessionsUser$inboundSchema: z.ZodType = + z.object({ + id: z.string().optional(), + thumb: z.string().optional(), + title: z.string().optional(), + }); + +/** @internal */ +export type GetSessionsUser$Outbound = { + id?: string | undefined; + thumb?: string | undefined; + title?: string | undefined; +}; + +/** @internal */ +export const GetSessionsUser$outboundSchema: z.ZodType< + GetSessionsUser$Outbound, + z.ZodTypeDef, + GetSessionsUser +> = z.object({ + id: z.string().optional(), + thumb: z.string().optional(), + title: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsUser$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - thumb: z.string().optional(), - title: z.string().optional(), - }); - - export type Outbound = { - id?: string | undefined; - thumb?: string | undefined; - title?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - thumb: z.string().optional(), - title: z.string().optional(), - }); + /** @deprecated use `GetSessionsUser$inboundSchema` instead. */ + export const inboundSchema = GetSessionsUser$inboundSchema; + /** @deprecated use `GetSessionsUser$outboundSchema` instead. */ + export const outboundSchema = GetSessionsUser$outboundSchema; + /** @deprecated use `GetSessionsUser$Outbound` instead. */ + export type Outbound = GetSessionsUser$Outbound; } /** @internal */ +export const Player$inboundSchema: z.ZodType = z.object({ + address: z.string().optional(), + machineIdentifier: z.string().optional(), + model: z.string().optional(), + platform: z.string().optional(), + platformVersion: z.string().optional(), + product: z.string().optional(), + profile: z.string().optional(), + remotePublicAddress: z.string().optional(), + state: z.string().optional(), + title: z.string().optional(), + version: z.string().optional(), + local: z.boolean().optional(), + relayed: z.boolean().optional(), + secure: z.boolean().optional(), + userID: z.number().int().optional(), +}); + +/** @internal */ +export type Player$Outbound = { + address?: string | undefined; + machineIdentifier?: string | undefined; + model?: string | undefined; + platform?: string | undefined; + platformVersion?: string | undefined; + product?: string | undefined; + profile?: string | undefined; + remotePublicAddress?: string | undefined; + state?: string | undefined; + title?: string | undefined; + version?: string | undefined; + local?: boolean | undefined; + relayed?: boolean | undefined; + secure?: boolean | undefined; + userID?: number | undefined; +}; + +/** @internal */ +export const Player$outboundSchema: z.ZodType = z.object({ + address: z.string().optional(), + machineIdentifier: z.string().optional(), + model: z.string().optional(), + platform: z.string().optional(), + platformVersion: z.string().optional(), + product: z.string().optional(), + profile: z.string().optional(), + remotePublicAddress: z.string().optional(), + state: z.string().optional(), + title: z.string().optional(), + version: z.string().optional(), + local: z.boolean().optional(), + relayed: z.boolean().optional(), + secure: z.boolean().optional(), + userID: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Player$ { - export const inboundSchema: z.ZodType = z.object({ - address: z.string().optional(), - machineIdentifier: z.string().optional(), - model: z.string().optional(), - platform: z.string().optional(), - platformVersion: z.string().optional(), - product: z.string().optional(), - profile: z.string().optional(), - remotePublicAddress: z.string().optional(), - state: z.string().optional(), - title: z.string().optional(), - version: z.string().optional(), - local: z.boolean().optional(), - relayed: z.boolean().optional(), - secure: z.boolean().optional(), - userID: z.number().int().optional(), - }); - - export type Outbound = { - address?: string | undefined; - machineIdentifier?: string | undefined; - model?: string | undefined; - platform?: string | undefined; - platformVersion?: string | undefined; - product?: string | undefined; - profile?: string | undefined; - remotePublicAddress?: string | undefined; - state?: string | undefined; - title?: string | undefined; - version?: string | undefined; - local?: boolean | undefined; - relayed?: boolean | undefined; - secure?: boolean | undefined; - userID?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - address: z.string().optional(), - machineIdentifier: z.string().optional(), - model: z.string().optional(), - platform: z.string().optional(), - platformVersion: z.string().optional(), - product: z.string().optional(), - profile: z.string().optional(), - remotePublicAddress: z.string().optional(), - state: z.string().optional(), - title: z.string().optional(), - version: z.string().optional(), - local: z.boolean().optional(), - relayed: z.boolean().optional(), - secure: z.boolean().optional(), - userID: z.number().int().optional(), - }); + /** @deprecated use `Player$inboundSchema` instead. */ + export const inboundSchema = Player$inboundSchema; + /** @deprecated use `Player$outboundSchema` instead. */ + export const outboundSchema = Player$outboundSchema; + /** @deprecated use `Player$Outbound` instead. */ + export type Outbound = Player$Outbound; } /** @internal */ +export const Session$inboundSchema: z.ZodType = z.object({ + id: z.string().optional(), + bandwidth: z.number().int().optional(), + location: z.string().optional(), +}); + +/** @internal */ +export type Session$Outbound = { + id?: string | undefined; + bandwidth?: number | undefined; + location?: string | undefined; +}; + +/** @internal */ +export const Session$outboundSchema: z.ZodType = z.object({ + id: z.string().optional(), + bandwidth: z.number().int().optional(), + location: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Session$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - bandwidth: z.number().int().optional(), - location: z.string().optional(), - }); - - export type Outbound = { - id?: string | undefined; - bandwidth?: number | undefined; - location?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.string().optional(), - bandwidth: z.number().int().optional(), - location: z.string().optional(), - }); + /** @deprecated use `Session$inboundSchema` instead. */ + export const inboundSchema = Session$inboundSchema; + /** @deprecated use `Session$outboundSchema` instead. */ + export const outboundSchema = Session$outboundSchema; + /** @deprecated use `Session$Outbound` instead. */ + export type Outbound = Session$Outbound; } /** @internal */ +export const GetSessionsMetadata$inboundSchema: z.ZodType< + GetSessionsMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + addedAt: z.number().int().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + grandparentArt: z.string().optional(), + grandparentGuid: z.string().optional(), + grandparentKey: z.string().optional(), + grandparentRatingKey: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentTitle: z.string().optional(), + guid: z.string().optional(), + index: z.number().int().optional(), + key: z.string().optional(), + librarySectionID: z.string().optional(), + librarySectionKey: z.string().optional(), + librarySectionTitle: z.string().optional(), + musicAnalysisVersion: z.string().optional(), + parentGuid: z.string().optional(), + parentIndex: z.number().int().optional(), + parentKey: z.string().optional(), + parentRatingKey: z.string().optional(), + parentStudio: z.string().optional(), + parentThumb: z.string().optional(), + parentTitle: z.string().optional(), + parentYear: z.number().int().optional(), + ratingCount: z.number().int().optional(), + ratingKey: z.string().optional(), + sessionKey: z.string().optional(), + thumb: z.string().optional(), + title: z.string().optional(), + titleSort: z.string().optional(), + type: z.string().optional(), + updatedAt: z.number().int().optional(), + viewOffset: z.number().int().optional(), + Media: z.array(z.lazy(() => GetSessionsMedia$inboundSchema)).optional(), + User: z.lazy(() => GetSessionsUser$inboundSchema).optional(), + Player: z.lazy(() => Player$inboundSchema).optional(), + Session: z.lazy(() => Session$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + Media: "media", + User: "user", + Player: "player", + Session: "session", + }); + }); + +/** @internal */ +export type GetSessionsMetadata$Outbound = { + addedAt?: number | undefined; + art?: string | undefined; + duration?: number | undefined; + grandparentArt?: string | undefined; + grandparentGuid?: string | undefined; + grandparentKey?: string | undefined; + grandparentRatingKey?: string | undefined; + grandparentThumb?: string | undefined; + grandparentTitle?: string | undefined; + guid?: string | undefined; + index?: number | undefined; + key?: string | undefined; + librarySectionID?: string | undefined; + librarySectionKey?: string | undefined; + librarySectionTitle?: string | undefined; + musicAnalysisVersion?: string | undefined; + parentGuid?: string | undefined; + parentIndex?: number | undefined; + parentKey?: string | undefined; + parentRatingKey?: string | undefined; + parentStudio?: string | undefined; + parentThumb?: string | undefined; + parentTitle?: string | undefined; + parentYear?: number | undefined; + ratingCount?: number | undefined; + ratingKey?: string | undefined; + sessionKey?: string | undefined; + thumb?: string | undefined; + title?: string | undefined; + titleSort?: string | undefined; + type?: string | undefined; + updatedAt?: number | undefined; + viewOffset?: number | undefined; + Media?: Array | undefined; + User?: GetSessionsUser$Outbound | undefined; + Player?: Player$Outbound | undefined; + Session?: Session$Outbound | undefined; +}; + +/** @internal */ +export const GetSessionsMetadata$outboundSchema: z.ZodType< + GetSessionsMetadata$Outbound, + z.ZodTypeDef, + GetSessionsMetadata +> = z + .object({ + addedAt: z.number().int().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + grandparentArt: z.string().optional(), + grandparentGuid: z.string().optional(), + grandparentKey: z.string().optional(), + grandparentRatingKey: z.string().optional(), + grandparentThumb: z.string().optional(), + grandparentTitle: z.string().optional(), + guid: z.string().optional(), + index: z.number().int().optional(), + key: z.string().optional(), + librarySectionID: z.string().optional(), + librarySectionKey: z.string().optional(), + librarySectionTitle: z.string().optional(), + musicAnalysisVersion: z.string().optional(), + parentGuid: z.string().optional(), + parentIndex: z.number().int().optional(), + parentKey: z.string().optional(), + parentRatingKey: z.string().optional(), + parentStudio: z.string().optional(), + parentThumb: z.string().optional(), + parentTitle: z.string().optional(), + parentYear: z.number().int().optional(), + ratingCount: z.number().int().optional(), + ratingKey: z.string().optional(), + sessionKey: z.string().optional(), + thumb: z.string().optional(), + title: z.string().optional(), + titleSort: z.string().optional(), + type: z.string().optional(), + updatedAt: z.number().int().optional(), + viewOffset: z.number().int().optional(), + media: z.array(z.lazy(() => GetSessionsMedia$outboundSchema)).optional(), + user: z.lazy(() => GetSessionsUser$outboundSchema).optional(), + player: z.lazy(() => Player$outboundSchema).optional(), + session: z.lazy(() => Session$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + media: "Media", + user: "User", + player: "Player", + session: "Session", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - addedAt: z.number().int().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - grandparentArt: z.string().optional(), - grandparentGuid: z.string().optional(), - grandparentKey: z.string().optional(), - grandparentRatingKey: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentTitle: z.string().optional(), - guid: z.string().optional(), - index: z.number().int().optional(), - key: z.string().optional(), - librarySectionID: z.string().optional(), - librarySectionKey: z.string().optional(), - librarySectionTitle: z.string().optional(), - musicAnalysisVersion: z.string().optional(), - parentGuid: z.string().optional(), - parentIndex: z.number().int().optional(), - parentKey: z.string().optional(), - parentRatingKey: z.string().optional(), - parentStudio: z.string().optional(), - parentThumb: z.string().optional(), - parentTitle: z.string().optional(), - parentYear: z.number().int().optional(), - ratingCount: z.number().int().optional(), - ratingKey: z.string().optional(), - sessionKey: z.string().optional(), - thumb: z.string().optional(), - title: z.string().optional(), - titleSort: z.string().optional(), - type: z.string().optional(), - updatedAt: z.number().int().optional(), - viewOffset: z.number().int().optional(), - Media: z.array(z.lazy(() => GetSessionsMedia$.inboundSchema)).optional(), - User: z.lazy(() => GetSessionsUser$.inboundSchema).optional(), - Player: z.lazy(() => Player$.inboundSchema).optional(), - Session: z.lazy(() => Session$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - Media: "media", - User: "user", - Player: "player", - Session: "session", - }); - }); - - export type Outbound = { - addedAt?: number | undefined; - art?: string | undefined; - duration?: number | undefined; - grandparentArt?: string | undefined; - grandparentGuid?: string | undefined; - grandparentKey?: string | undefined; - grandparentRatingKey?: string | undefined; - grandparentThumb?: string | undefined; - grandparentTitle?: string | undefined; - guid?: string | undefined; - index?: number | undefined; - key?: string | undefined; - librarySectionID?: string | undefined; - librarySectionKey?: string | undefined; - librarySectionTitle?: string | undefined; - musicAnalysisVersion?: string | undefined; - parentGuid?: string | undefined; - parentIndex?: number | undefined; - parentKey?: string | undefined; - parentRatingKey?: string | undefined; - parentStudio?: string | undefined; - parentThumb?: string | undefined; - parentTitle?: string | undefined; - parentYear?: number | undefined; - ratingCount?: number | undefined; - ratingKey?: string | undefined; - sessionKey?: string | undefined; - thumb?: string | undefined; - title?: string | undefined; - titleSort?: string | undefined; - type?: string | undefined; - updatedAt?: number | undefined; - viewOffset?: number | undefined; - Media?: Array | undefined; - User?: GetSessionsUser$.Outbound | undefined; - Player?: Player$.Outbound | undefined; - Session?: Session$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - addedAt: z.number().int().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - grandparentArt: z.string().optional(), - grandparentGuid: z.string().optional(), - grandparentKey: z.string().optional(), - grandparentRatingKey: z.string().optional(), - grandparentThumb: z.string().optional(), - grandparentTitle: z.string().optional(), - guid: z.string().optional(), - index: z.number().int().optional(), - key: z.string().optional(), - librarySectionID: z.string().optional(), - librarySectionKey: z.string().optional(), - librarySectionTitle: z.string().optional(), - musicAnalysisVersion: z.string().optional(), - parentGuid: z.string().optional(), - parentIndex: z.number().int().optional(), - parentKey: z.string().optional(), - parentRatingKey: z.string().optional(), - parentStudio: z.string().optional(), - parentThumb: z.string().optional(), - parentTitle: z.string().optional(), - parentYear: z.number().int().optional(), - ratingCount: z.number().int().optional(), - ratingKey: z.string().optional(), - sessionKey: z.string().optional(), - thumb: z.string().optional(), - title: z.string().optional(), - titleSort: z.string().optional(), - type: z.string().optional(), - updatedAt: z.number().int().optional(), - viewOffset: z.number().int().optional(), - media: z.array(z.lazy(() => GetSessionsMedia$.outboundSchema)).optional(), - user: z.lazy(() => GetSessionsUser$.outboundSchema).optional(), - player: z.lazy(() => Player$.outboundSchema).optional(), - session: z.lazy(() => Session$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - media: "Media", - user: "User", - player: "Player", - session: "Session", - }); - }); + /** @deprecated use `GetSessionsMetadata$inboundSchema` instead. */ + export const inboundSchema = GetSessionsMetadata$inboundSchema; + /** @deprecated use `GetSessionsMetadata$outboundSchema` instead. */ + export const outboundSchema = GetSessionsMetadata$outboundSchema; + /** @deprecated use `GetSessionsMetadata$Outbound` instead. */ + export type Outbound = GetSessionsMetadata$Outbound; } /** @internal */ +export const GetSessionsMediaContainer$inboundSchema: z.ZodType< + GetSessionsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Metadata: z.array(z.lazy(() => GetSessionsMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetSessionsMediaContainer$Outbound = { + size?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetSessionsMediaContainer$outboundSchema: z.ZodType< + GetSessionsMediaContainer$Outbound, + z.ZodTypeDef, + GetSessionsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + metadata: z.array(z.lazy(() => GetSessionsMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - Metadata: z.array(z.lazy(() => GetSessionsMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - metadata: z.array(z.lazy(() => GetSessionsMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetSessionsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetSessionsMediaContainer$inboundSchema; + /** @deprecated use `GetSessionsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetSessionsMediaContainer$outboundSchema; + /** @deprecated use `GetSessionsMediaContainer$Outbound` instead. */ + export type Outbound = GetSessionsMediaContainer$Outbound; } /** @internal */ +export const GetSessionsResponseBody$inboundSchema: z.ZodType< + GetSessionsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetSessionsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetSessionsResponseBody$Outbound = { + MediaContainer?: GetSessionsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetSessionsResponseBody$outboundSchema: z.ZodType< + GetSessionsResponseBody$Outbound, + z.ZodTypeDef, + GetSessionsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetSessionsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetSessionsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetSessionsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetSessionsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetSessionsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSessionsResponseBody$inboundSchema; + /** @deprecated use `GetSessionsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSessionsResponseBody$outboundSchema; + /** @deprecated use `GetSessionsResponseBody$Outbound` instead. */ + export type Outbound = GetSessionsResponseBody$Outbound; } /** @internal */ +export const GetSessionsResponse$inboundSchema: z.ZodType< + GetSessionsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetSessionsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetSessionsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetSessionsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetSessionsResponse$outboundSchema: z.ZodType< + GetSessionsResponse$Outbound, + z.ZodTypeDef, + GetSessionsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetSessionsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSessionsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetSessionsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetSessionsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetSessionsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetSessionsResponse$inboundSchema` instead. */ + export const inboundSchema = GetSessionsResponse$inboundSchema; + /** @deprecated use `GetSessionsResponse$outboundSchema` instead. */ + export const outboundSchema = GetSessionsResponse$outboundSchema; + /** @deprecated use `GetSessionsResponse$Outbound` instead. */ + export type Outbound = GetSessionsResponse$Outbound; } diff --git a/src/models/getsourceconnectioninformationop.ts b/src/models/getsourceconnectioninformationop.ts index 8f68e435..dc142920 100644 --- a/src/models/getsourceconnectioninformationop.ts +++ b/src/models/getsourceconnectioninformationop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class GetSourceConnectionInformationResponseBody extends Error { data$: GetSourceConnectionInformationResponseBodyData; constructor(err: GetSourceConnectionInformationResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class GetSourceConnectionInformationResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetSourceConnectionInformationResponseBody"; } } @@ -78,154 +77,206 @@ export type GetSourceConnectionInformationResponse = { }; /** @internal */ +export const GetSourceConnectionInformationRequest$inboundSchema: z.ZodType< + GetSourceConnectionInformationRequest, + z.ZodTypeDef, + unknown +> = z.object({ + source: z.string(), +}); + +/** @internal */ +export type GetSourceConnectionInformationRequest$Outbound = { + source: string; +}; + +/** @internal */ +export const GetSourceConnectionInformationRequest$outboundSchema: z.ZodType< + GetSourceConnectionInformationRequest$Outbound, + z.ZodTypeDef, + GetSourceConnectionInformationRequest +> = z.object({ + source: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSourceConnectionInformationRequest$ { - export const inboundSchema: z.ZodType< - GetSourceConnectionInformationRequest, - z.ZodTypeDef, - unknown - > = z.object({ - source: z.string(), - }); - - export type Outbound = { - source: string; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSourceConnectionInformationRequest - > = z.object({ - source: z.string(), - }); + /** @deprecated use `GetSourceConnectionInformationRequest$inboundSchema` instead. */ + export const inboundSchema = GetSourceConnectionInformationRequest$inboundSchema; + /** @deprecated use `GetSourceConnectionInformationRequest$outboundSchema` instead. */ + export const outboundSchema = GetSourceConnectionInformationRequest$outboundSchema; + /** @deprecated use `GetSourceConnectionInformationRequest$Outbound` instead. */ + export type Outbound = GetSourceConnectionInformationRequest$Outbound; } /** @internal */ +export const GetSourceConnectionInformationErrors$inboundSchema: z.ZodType< + GetSourceConnectionInformationErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetSourceConnectionInformationErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetSourceConnectionInformationErrors$outboundSchema: z.ZodType< + GetSourceConnectionInformationErrors$Outbound, + z.ZodTypeDef, + GetSourceConnectionInformationErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSourceConnectionInformationErrors$ { - export const inboundSchema: z.ZodType< - GetSourceConnectionInformationErrors, - z.ZodTypeDef, - unknown - > = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSourceConnectionInformationErrors - > = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetSourceConnectionInformationErrors$inboundSchema` instead. */ + export const inboundSchema = GetSourceConnectionInformationErrors$inboundSchema; + /** @deprecated use `GetSourceConnectionInformationErrors$outboundSchema` instead. */ + export const outboundSchema = GetSourceConnectionInformationErrors$outboundSchema; + /** @deprecated use `GetSourceConnectionInformationErrors$Outbound` instead. */ + export type Outbound = GetSourceConnectionInformationErrors$Outbound; } /** @internal */ +export const GetSourceConnectionInformationResponseBody$inboundSchema: z.ZodType< + GetSourceConnectionInformationResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z + .array(z.lazy(() => GetSourceConnectionInformationErrors$inboundSchema)) + .optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetSourceConnectionInformationResponseBody(remapped); + }); + +/** @internal */ +export type GetSourceConnectionInformationResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetSourceConnectionInformationResponseBody$outboundSchema: z.ZodType< + GetSourceConnectionInformationResponseBody$Outbound, + z.ZodTypeDef, + GetSourceConnectionInformationResponseBody +> = z + .instanceof(GetSourceConnectionInformationResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z + .array(z.lazy(() => GetSourceConnectionInformationErrors$outboundSchema)) + .optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSourceConnectionInformationResponseBody$ { - export const inboundSchema: z.ZodType< - GetSourceConnectionInformationResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z - .array(z.lazy(() => GetSourceConnectionInformationErrors$.inboundSchema)) - .optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetSourceConnectionInformationResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSourceConnectionInformationResponseBody - > = z - .instanceof(GetSourceConnectionInformationResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetSourceConnectionInformationErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetSourceConnectionInformationResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetSourceConnectionInformationResponseBody$inboundSchema; + /** @deprecated use `GetSourceConnectionInformationResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetSourceConnectionInformationResponseBody$outboundSchema; + /** @deprecated use `GetSourceConnectionInformationResponseBody$Outbound` instead. */ + export type Outbound = GetSourceConnectionInformationResponseBody$Outbound; } /** @internal */ +export const GetSourceConnectionInformationResponse$inboundSchema: z.ZodType< + GetSourceConnectionInformationResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetSourceConnectionInformationResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const GetSourceConnectionInformationResponse$outboundSchema: z.ZodType< + GetSourceConnectionInformationResponse$Outbound, + z.ZodTypeDef, + GetSourceConnectionInformationResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetSourceConnectionInformationResponse$ { - export const inboundSchema: z.ZodType< - GetSourceConnectionInformationResponse, - z.ZodTypeDef, - unknown - > = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetSourceConnectionInformationResponse - > = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetSourceConnectionInformationResponse$inboundSchema` instead. */ + export const inboundSchema = GetSourceConnectionInformationResponse$inboundSchema; + /** @deprecated use `GetSourceConnectionInformationResponse$outboundSchema` instead. */ + export const outboundSchema = GetSourceConnectionInformationResponse$outboundSchema; + /** @deprecated use `GetSourceConnectionInformationResponse$Outbound` instead. */ + export type Outbound = GetSourceConnectionInformationResponse$Outbound; } diff --git a/src/models/getstatisticsop.ts b/src/models/getstatisticsop.ts index 13501df2..1a20b393 100644 --- a/src/models/getstatisticsop.ts +++ b/src/models/getstatisticsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -47,7 +47,11 @@ export class GetStatisticsStatisticsResponseBody extends Error { data$: GetStatisticsStatisticsResponseBodyData; constructor(err: GetStatisticsStatisticsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -57,11 +61,6 @@ export class GetStatisticsStatisticsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetStatisticsStatisticsResponseBody"; } } @@ -129,304 +128,474 @@ export type GetStatisticsResponse = { }; /** @internal */ +export const GetStatisticsRequest$inboundSchema: z.ZodType< + GetStatisticsRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + Timespan: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + Timespan: "timespan", + }); + }); + +/** @internal */ +export type GetStatisticsRequest$Outbound = { + Timespan?: number | undefined; +}; + +/** @internal */ +export const GetStatisticsRequest$outboundSchema: z.ZodType< + GetStatisticsRequest$Outbound, + z.ZodTypeDef, + GetStatisticsRequest +> = z + .object({ + timespan: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + timespan: "Timespan", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsRequest$ { - export const inboundSchema: z.ZodType = z - .object({ - Timespan: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - Timespan: "timespan", - }); - }); - - export type Outbound = { - Timespan?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - timespan: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - timespan: "Timespan", - }); - }); + /** @deprecated use `GetStatisticsRequest$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsRequest$inboundSchema; + /** @deprecated use `GetStatisticsRequest$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsRequest$outboundSchema; + /** @deprecated use `GetStatisticsRequest$Outbound` instead. */ + export type Outbound = GetStatisticsRequest$Outbound; } /** @internal */ +export const GetStatisticsErrors$inboundSchema: z.ZodType< + GetStatisticsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetStatisticsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetStatisticsErrors$outboundSchema: z.ZodType< + GetStatisticsErrors$Outbound, + z.ZodTypeDef, + GetStatisticsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetStatisticsErrors$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsErrors$inboundSchema; + /** @deprecated use `GetStatisticsErrors$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsErrors$outboundSchema; + /** @deprecated use `GetStatisticsErrors$Outbound` instead. */ + export type Outbound = GetStatisticsErrors$Outbound; } /** @internal */ +export const GetStatisticsStatisticsResponseBody$inboundSchema: z.ZodType< + GetStatisticsStatisticsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetStatisticsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetStatisticsStatisticsResponseBody(remapped); + }); + +/** @internal */ +export type GetStatisticsStatisticsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetStatisticsStatisticsResponseBody$outboundSchema: z.ZodType< + GetStatisticsStatisticsResponseBody$Outbound, + z.ZodTypeDef, + GetStatisticsStatisticsResponseBody +> = z + .instanceof(GetStatisticsStatisticsResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetStatisticsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsStatisticsResponseBody$ { - export const inboundSchema: z.ZodType< - GetStatisticsStatisticsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetStatisticsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetStatisticsStatisticsResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetStatisticsStatisticsResponseBody - > = z - .instanceof(GetStatisticsStatisticsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetStatisticsErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetStatisticsStatisticsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsStatisticsResponseBody$inboundSchema; + /** @deprecated use `GetStatisticsStatisticsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsStatisticsResponseBody$outboundSchema; + /** @deprecated use `GetStatisticsStatisticsResponseBody$Outbound` instead. */ + export type Outbound = GetStatisticsStatisticsResponseBody$Outbound; } /** @internal */ +export const GetStatisticsDevice$inboundSchema: z.ZodType< + GetStatisticsDevice, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + name: z.string().optional(), + platform: z.string().optional(), + clientIdentifier: z.string().optional(), + createdAt: z.number().int().optional(), +}); + +/** @internal */ +export type GetStatisticsDevice$Outbound = { + id?: number | undefined; + name?: string | undefined; + platform?: string | undefined; + clientIdentifier?: string | undefined; + createdAt?: number | undefined; +}; + +/** @internal */ +export const GetStatisticsDevice$outboundSchema: z.ZodType< + GetStatisticsDevice$Outbound, + z.ZodTypeDef, + GetStatisticsDevice +> = z.object({ + id: z.number().int().optional(), + name: z.string().optional(), + platform: z.string().optional(), + clientIdentifier: z.string().optional(), + createdAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsDevice$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - name: z.string().optional(), - platform: z.string().optional(), - clientIdentifier: z.string().optional(), - createdAt: z.number().int().optional(), - }); - - export type Outbound = { - id?: number | undefined; - name?: string | undefined; - platform?: string | undefined; - clientIdentifier?: string | undefined; - createdAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - name: z.string().optional(), - platform: z.string().optional(), - clientIdentifier: z.string().optional(), - createdAt: z.number().int().optional(), - }); + /** @deprecated use `GetStatisticsDevice$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsDevice$inboundSchema; + /** @deprecated use `GetStatisticsDevice$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsDevice$outboundSchema; + /** @deprecated use `GetStatisticsDevice$Outbound` instead. */ + export type Outbound = GetStatisticsDevice$Outbound; } /** @internal */ +export const Account$inboundSchema: z.ZodType = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + name: z.string().optional(), + defaultAudioLanguage: z.string().optional(), + autoSelectAudio: z.boolean().optional(), + defaultSubtitleLanguage: z.string().optional(), + subtitleMode: z.number().int().optional(), + thumb: z.string().optional(), +}); + +/** @internal */ +export type Account$Outbound = { + id?: number | undefined; + key?: string | undefined; + name?: string | undefined; + defaultAudioLanguage?: string | undefined; + autoSelectAudio?: boolean | undefined; + defaultSubtitleLanguage?: string | undefined; + subtitleMode?: number | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const Account$outboundSchema: z.ZodType = z.object({ + id: z.number().int().optional(), + key: z.string().optional(), + name: z.string().optional(), + defaultAudioLanguage: z.string().optional(), + autoSelectAudio: z.boolean().optional(), + defaultSubtitleLanguage: z.string().optional(), + subtitleMode: z.number().int().optional(), + thumb: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Account$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - name: z.string().optional(), - defaultAudioLanguage: z.string().optional(), - autoSelectAudio: z.boolean().optional(), - defaultSubtitleLanguage: z.string().optional(), - subtitleMode: z.number().int().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - key?: string | undefined; - name?: string | undefined; - defaultAudioLanguage?: string | undefined; - autoSelectAudio?: boolean | undefined; - defaultSubtitleLanguage?: string | undefined; - subtitleMode?: number | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - key: z.string().optional(), - name: z.string().optional(), - defaultAudioLanguage: z.string().optional(), - autoSelectAudio: z.boolean().optional(), - defaultSubtitleLanguage: z.string().optional(), - subtitleMode: z.number().int().optional(), - thumb: z.string().optional(), - }); + /** @deprecated use `Account$inboundSchema` instead. */ + export const inboundSchema = Account$inboundSchema; + /** @deprecated use `Account$outboundSchema` instead. */ + export const outboundSchema = Account$outboundSchema; + /** @deprecated use `Account$Outbound` instead. */ + export type Outbound = Account$Outbound; } /** @internal */ +export const StatisticsMedia$inboundSchema: z.ZodType = + z.object({ + accountID: z.number().int().optional(), + deviceID: z.number().int().optional(), + timespan: z.number().int().optional(), + at: z.number().int().optional(), + metadataType: z.number().int().optional(), + count: z.number().int().optional(), + duration: z.number().int().optional(), + }); + +/** @internal */ +export type StatisticsMedia$Outbound = { + accountID?: number | undefined; + deviceID?: number | undefined; + timespan?: number | undefined; + at?: number | undefined; + metadataType?: number | undefined; + count?: number | undefined; + duration?: number | undefined; +}; + +/** @internal */ +export const StatisticsMedia$outboundSchema: z.ZodType< + StatisticsMedia$Outbound, + z.ZodTypeDef, + StatisticsMedia +> = z.object({ + accountID: z.number().int().optional(), + deviceID: z.number().int().optional(), + timespan: z.number().int().optional(), + at: z.number().int().optional(), + metadataType: z.number().int().optional(), + count: z.number().int().optional(), + duration: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StatisticsMedia$ { - export const inboundSchema: z.ZodType = z.object({ - accountID: z.number().int().optional(), - deviceID: z.number().int().optional(), - timespan: z.number().int().optional(), - at: z.number().int().optional(), - metadataType: z.number().int().optional(), - count: z.number().int().optional(), - duration: z.number().int().optional(), - }); - - export type Outbound = { - accountID?: number | undefined; - deviceID?: number | undefined; - timespan?: number | undefined; - at?: number | undefined; - metadataType?: number | undefined; - count?: number | undefined; - duration?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - accountID: z.number().int().optional(), - deviceID: z.number().int().optional(), - timespan: z.number().int().optional(), - at: z.number().int().optional(), - metadataType: z.number().int().optional(), - count: z.number().int().optional(), - duration: z.number().int().optional(), - }); + /** @deprecated use `StatisticsMedia$inboundSchema` instead. */ + export const inboundSchema = StatisticsMedia$inboundSchema; + /** @deprecated use `StatisticsMedia$outboundSchema` instead. */ + export const outboundSchema = StatisticsMedia$outboundSchema; + /** @deprecated use `StatisticsMedia$Outbound` instead. */ + export type Outbound = StatisticsMedia$Outbound; } /** @internal */ +export const GetStatisticsMediaContainer$inboundSchema: z.ZodType< + GetStatisticsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + Device: z.array(z.lazy(() => GetStatisticsDevice$inboundSchema)).optional(), + Account: z.array(z.lazy(() => Account$inboundSchema)).optional(), + StatisticsMedia: z.array(z.lazy(() => StatisticsMedia$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Device: "device", + Account: "account", + StatisticsMedia: "statisticsMedia", + }); + }); + +/** @internal */ +export type GetStatisticsMediaContainer$Outbound = { + size?: number | undefined; + Device?: Array | undefined; + Account?: Array | undefined; + StatisticsMedia?: Array | undefined; +}; + +/** @internal */ +export const GetStatisticsMediaContainer$outboundSchema: z.ZodType< + GetStatisticsMediaContainer$Outbound, + z.ZodTypeDef, + GetStatisticsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + device: z.array(z.lazy(() => GetStatisticsDevice$outboundSchema)).optional(), + account: z.array(z.lazy(() => Account$outboundSchema)).optional(), + statisticsMedia: z.array(z.lazy(() => StatisticsMedia$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + device: "Device", + account: "Account", + statisticsMedia: "StatisticsMedia", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - Device: z.array(z.lazy(() => GetStatisticsDevice$.inboundSchema)).optional(), - Account: z.array(z.lazy(() => Account$.inboundSchema)).optional(), - StatisticsMedia: z.array(z.lazy(() => StatisticsMedia$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Device: "device", - Account: "account", - StatisticsMedia: "statisticsMedia", - }); - }); - - export type Outbound = { - size?: number | undefined; - Device?: Array | undefined; - Account?: Array | undefined; - StatisticsMedia?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - device: z.array(z.lazy(() => GetStatisticsDevice$.outboundSchema)).optional(), - account: z.array(z.lazy(() => Account$.outboundSchema)).optional(), - statisticsMedia: z.array(z.lazy(() => StatisticsMedia$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - device: "Device", - account: "Account", - statisticsMedia: "StatisticsMedia", - }); - }); + /** @deprecated use `GetStatisticsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsMediaContainer$inboundSchema; + /** @deprecated use `GetStatisticsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsMediaContainer$outboundSchema; + /** @deprecated use `GetStatisticsMediaContainer$Outbound` instead. */ + export type Outbound = GetStatisticsMediaContainer$Outbound; } /** @internal */ +export const GetStatisticsResponseBody$inboundSchema: z.ZodType< + GetStatisticsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetStatisticsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetStatisticsResponseBody$Outbound = { + MediaContainer?: GetStatisticsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetStatisticsResponseBody$outboundSchema: z.ZodType< + GetStatisticsResponseBody$Outbound, + z.ZodTypeDef, + GetStatisticsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetStatisticsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetStatisticsMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetStatisticsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetStatisticsMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetStatisticsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsResponseBody$inboundSchema; + /** @deprecated use `GetStatisticsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsResponseBody$outboundSchema; + /** @deprecated use `GetStatisticsResponseBody$Outbound` instead. */ + export type Outbound = GetStatisticsResponseBody$Outbound; } /** @internal */ +export const GetStatisticsResponse$inboundSchema: z.ZodType< + GetStatisticsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetStatisticsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetStatisticsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetStatisticsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetStatisticsResponse$outboundSchema: z.ZodType< + GetStatisticsResponse$Outbound, + z.ZodTypeDef, + GetStatisticsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetStatisticsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetStatisticsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetStatisticsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetStatisticsResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetStatisticsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetStatisticsResponse$inboundSchema` instead. */ + export const inboundSchema = GetStatisticsResponse$inboundSchema; + /** @deprecated use `GetStatisticsResponse$outboundSchema` instead. */ + export const outboundSchema = GetStatisticsResponse$outboundSchema; + /** @deprecated use `GetStatisticsResponse$Outbound` instead. */ + export type Outbound = GetStatisticsResponse$Outbound; } diff --git a/src/models/gettimelineop.ts b/src/models/gettimelineop.ts index edbb916f..ff13bee2 100644 --- a/src/models/gettimelineop.ts +++ b/src/models/gettimelineop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -88,7 +88,11 @@ export class GetTimelineResponseBody extends Error { data$: GetTimelineResponseBodyData; constructor(err: GetTimelineResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -98,11 +102,6 @@ export class GetTimelineResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetTimelineResponseBody"; } } @@ -123,151 +122,243 @@ export type GetTimelineResponse = { }; /** @internal */ +export const State$inboundSchema: z.ZodNativeEnum = z.nativeEnum(State); + +/** @internal */ +export const State$outboundSchema: z.ZodNativeEnum = State$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace State$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(State); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `State$inboundSchema` instead. */ + export const inboundSchema = State$inboundSchema; + /** @deprecated use `State$outboundSchema` instead. */ + export const outboundSchema = State$outboundSchema; } /** @internal */ +export const GetTimelineRequest$inboundSchema: z.ZodType< + GetTimelineRequest, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.number(), + key: z.string(), + state: State$inboundSchema, + hasMDE: z.number(), + time: z.number(), + duration: z.number(), + context: z.string(), + playQueueItemID: z.number(), + playBackTime: z.number(), + row: z.number(), +}); + +/** @internal */ +export type GetTimelineRequest$Outbound = { + ratingKey: number; + key: string; + state: string; + hasMDE: number; + time: number; + duration: number; + context: string; + playQueueItemID: number; + playBackTime: number; + row: number; +}; + +/** @internal */ +export const GetTimelineRequest$outboundSchema: z.ZodType< + GetTimelineRequest$Outbound, + z.ZodTypeDef, + GetTimelineRequest +> = z.object({ + ratingKey: z.number(), + key: z.string(), + state: State$outboundSchema, + hasMDE: z.number(), + time: z.number(), + duration: z.number(), + context: z.string(), + playQueueItemID: z.number(), + playBackTime: z.number(), + row: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTimelineRequest$ { - export const inboundSchema: z.ZodType = z.object({ - ratingKey: z.number(), - key: z.string(), - state: State$.inboundSchema, - hasMDE: z.number(), - time: z.number(), - duration: z.number(), - context: z.string(), - playQueueItemID: z.number(), - playBackTime: z.number(), - row: z.number(), - }); - - export type Outbound = { - ratingKey: number; - key: string; - state: string; - hasMDE: number; - time: number; - duration: number; - context: string; - playQueueItemID: number; - playBackTime: number; - row: number; - }; - - export const outboundSchema: z.ZodType = z.object({ - ratingKey: z.number(), - key: z.string(), - state: State$.outboundSchema, - hasMDE: z.number(), - time: z.number(), - duration: z.number(), - context: z.string(), - playQueueItemID: z.number(), - playBackTime: z.number(), - row: z.number(), - }); + /** @deprecated use `GetTimelineRequest$inboundSchema` instead. */ + export const inboundSchema = GetTimelineRequest$inboundSchema; + /** @deprecated use `GetTimelineRequest$outboundSchema` instead. */ + export const outboundSchema = GetTimelineRequest$outboundSchema; + /** @deprecated use `GetTimelineRequest$Outbound` instead. */ + export type Outbound = GetTimelineRequest$Outbound; } /** @internal */ +export const GetTimelineErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type GetTimelineErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetTimelineErrors$outboundSchema: z.ZodType< + GetTimelineErrors$Outbound, + z.ZodTypeDef, + GetTimelineErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTimelineErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetTimelineErrors$inboundSchema` instead. */ + export const inboundSchema = GetTimelineErrors$inboundSchema; + /** @deprecated use `GetTimelineErrors$outboundSchema` instead. */ + export const outboundSchema = GetTimelineErrors$outboundSchema; + /** @deprecated use `GetTimelineErrors$Outbound` instead. */ + export type Outbound = GetTimelineErrors$Outbound; } /** @internal */ +export const GetTimelineResponseBody$inboundSchema: z.ZodType< + GetTimelineResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetTimelineErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetTimelineResponseBody(remapped); + }); + +/** @internal */ +export type GetTimelineResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetTimelineResponseBody$outboundSchema: z.ZodType< + GetTimelineResponseBody$Outbound, + z.ZodTypeDef, + GetTimelineResponseBody +> = z + .instanceof(GetTimelineResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetTimelineErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTimelineResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetTimelineErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetTimelineResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetTimelineResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetTimelineErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetTimelineResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetTimelineResponseBody$inboundSchema; + /** @deprecated use `GetTimelineResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetTimelineResponseBody$outboundSchema; + /** @deprecated use `GetTimelineResponseBody$Outbound` instead. */ + export type Outbound = GetTimelineResponseBody$Outbound; } /** @internal */ +export const GetTimelineResponse$inboundSchema: z.ZodType< + GetTimelineResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetTimelineResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const GetTimelineResponse$outboundSchema: z.ZodType< + GetTimelineResponse$Outbound, + z.ZodTypeDef, + GetTimelineResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTimelineResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetTimelineResponse$inboundSchema` instead. */ + export const inboundSchema = GetTimelineResponse$inboundSchema; + /** @deprecated use `GetTimelineResponse$outboundSchema` instead. */ + export const outboundSchema = GetTimelineResponse$outboundSchema; + /** @deprecated use `GetTimelineResponse$Outbound` instead. */ + export type Outbound = GetTimelineResponse$Outbound; } diff --git a/src/models/gettokenbypinidop.ts b/src/models/gettokenbypinidop.ts new file mode 100644 index 00000000..6c7fcfca --- /dev/null +++ b/src/models/gettokenbypinidop.ts @@ -0,0 +1,609 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const GetTokenByPinIdOpServerList = ["https://plex.tv/api/v2"] as const; + +export type GetTokenByPinIdGlobals = { + /** + * The unique identifier for the client application + * + * @remarks + * This is used to track the client application and its usage + * (UUID, serial number, or other number unique per device) + * + */ + xPlexClientIdentifier?: string | undefined; +}; + +export type GetTokenByPinIdRequest = { + /** + * The unique identifier for the client application + * + * @remarks + * This is used to track the client application and its usage + * (UUID, serial number, or other number unique per device) + * + */ + xPlexClientIdentifier?: string | undefined; + /** + * The PinID to retrieve an access token for + */ + pinID: number; +}; + +export type GetTokenByPinIdErrors = { + code?: number | undefined; + message?: string | undefined; +}; + +/** + * Not Found or Expired + */ +export type GetTokenByPinIdResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Not Found or Expired + */ +export class GetTokenByPinIdResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: GetTokenByPinIdResponseBodyData; + + constructor(err: GetTokenByPinIdResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "GetTokenByPinIdResponseBody"; + } +} + +/** + * Geo location data + */ +export type GetTokenByPinIdGeoData = { + /** + * The ISO 3166-1 alpha-2 code of the country. + */ + code: string; + /** + * The continent code where the country is located. + */ + continentCode: string; + /** + * The official name of the country. + */ + country: string; + /** + * The name of the city. + */ + city: string; + /** + * Indicates if the country is a member of the European Union. + */ + europeanUnionMember?: boolean | undefined; + /** + * The time zone of the country. + */ + timeZone: string; + /** + * The postal code of the location. + */ + postalCode: number; + /** + * Indicates if the country has privacy restrictions. + */ + inPrivacyRestrictedCountry?: boolean | undefined; + /** + * Indicates if the region has privacy restrictions. + */ + inPrivacyRestrictedRegion?: boolean | undefined; + /** + * The name of the primary administrative subdivision. + */ + subdivisions: string; + /** + * The geographical coordinates (latitude, longitude) of the location. + */ + coordinates: string; +}; + +/** + * The Pin with a non-null authToken when it has been verified by the user + */ +export type GetTokenByPinIdAuthPinContainer = { + id: number; + code: string; + product: string; + trusted?: boolean | undefined; + qr: string; + /** + * The X-Client-Identifier used in the request + */ + clientIdentifier: string; + /** + * Geo location data + */ + location: GetTokenByPinIdGeoData; + /** + * The number of seconds this pin expires, by default 900 seconds + */ + expiresIn?: number | undefined; + createdAt: Date; + expiresAt: Date; + authToken?: any | null | undefined; + newRegistration?: any | null | undefined; +}; + +export type GetTokenByPinIdResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * The Pin with a non-null authToken when it has been verified by the user + */ + authPinContainer?: GetTokenByPinIdAuthPinContainer | undefined; +}; + +/** @internal */ +export const GetTokenByPinIdGlobals$inboundSchema: z.ZodType< + GetTokenByPinIdGlobals, + z.ZodTypeDef, + unknown +> = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + }); + }); + +/** @internal */ +export type GetTokenByPinIdGlobals$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; +}; + +/** @internal */ +export const GetTokenByPinIdGlobals$outboundSchema: z.ZodType< + GetTokenByPinIdGlobals$Outbound, + z.ZodTypeDef, + GetTokenByPinIdGlobals +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdGlobals$ { + /** @deprecated use `GetTokenByPinIdGlobals$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdGlobals$inboundSchema; + /** @deprecated use `GetTokenByPinIdGlobals$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdGlobals$outboundSchema; + /** @deprecated use `GetTokenByPinIdGlobals$Outbound` instead. */ + export type Outbound = GetTokenByPinIdGlobals$Outbound; +} + +/** @internal */ +export const GetTokenByPinIdRequest$inboundSchema: z.ZodType< + GetTokenByPinIdRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + pinID: z.number().int(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + }); + }); + +/** @internal */ +export type GetTokenByPinIdRequest$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; + pinID: number; +}; + +/** @internal */ +export const GetTokenByPinIdRequest$outboundSchema: z.ZodType< + GetTokenByPinIdRequest$Outbound, + z.ZodTypeDef, + GetTokenByPinIdRequest +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + pinID: z.number().int(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdRequest$ { + /** @deprecated use `GetTokenByPinIdRequest$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdRequest$inboundSchema; + /** @deprecated use `GetTokenByPinIdRequest$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdRequest$outboundSchema; + /** @deprecated use `GetTokenByPinIdRequest$Outbound` instead. */ + export type Outbound = GetTokenByPinIdRequest$Outbound; +} + +/** @internal */ +export const GetTokenByPinIdErrors$inboundSchema: z.ZodType< + GetTokenByPinIdErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().int().optional(), + message: z.string().optional(), +}); + +/** @internal */ +export type GetTokenByPinIdErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; +}; + +/** @internal */ +export const GetTokenByPinIdErrors$outboundSchema: z.ZodType< + GetTokenByPinIdErrors$Outbound, + z.ZodTypeDef, + GetTokenByPinIdErrors +> = z.object({ + code: z.number().int().optional(), + message: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdErrors$ { + /** @deprecated use `GetTokenByPinIdErrors$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdErrors$inboundSchema; + /** @deprecated use `GetTokenByPinIdErrors$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdErrors$outboundSchema; + /** @deprecated use `GetTokenByPinIdErrors$Outbound` instead. */ + export type Outbound = GetTokenByPinIdErrors$Outbound; +} + +/** @internal */ +export const GetTokenByPinIdResponseBody$inboundSchema: z.ZodType< + GetTokenByPinIdResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetTokenByPinIdErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetTokenByPinIdResponseBody(remapped); + }); + +/** @internal */ +export type GetTokenByPinIdResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetTokenByPinIdResponseBody$outboundSchema: z.ZodType< + GetTokenByPinIdResponseBody$Outbound, + z.ZodTypeDef, + GetTokenByPinIdResponseBody +> = z + .instanceof(GetTokenByPinIdResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetTokenByPinIdErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdResponseBody$ { + /** @deprecated use `GetTokenByPinIdResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdResponseBody$inboundSchema; + /** @deprecated use `GetTokenByPinIdResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdResponseBody$outboundSchema; + /** @deprecated use `GetTokenByPinIdResponseBody$Outbound` instead. */ + export type Outbound = GetTokenByPinIdResponseBody$Outbound; +} + +/** @internal */ +export const GetTokenByPinIdGeoData$inboundSchema: z.ZodType< + GetTokenByPinIdGeoData, + z.ZodTypeDef, + unknown +> = z + .object({ + code: z.string(), + continent_code: z.string(), + country: z.string(), + city: z.string(), + european_union_member: z.boolean(), + time_zone: z.string(), + postal_code: z.number().int(), + in_privacy_restricted_country: z.boolean(), + in_privacy_restricted_region: z.boolean(), + subdivisions: z.string(), + coordinates: z.string(), + }) + .transform((v) => { + return remap$(v, { + continent_code: "continentCode", + european_union_member: "europeanUnionMember", + time_zone: "timeZone", + postal_code: "postalCode", + in_privacy_restricted_country: "inPrivacyRestrictedCountry", + in_privacy_restricted_region: "inPrivacyRestrictedRegion", + }); + }); + +/** @internal */ +export type GetTokenByPinIdGeoData$Outbound = { + code: string; + continent_code: string; + country: string; + city: string; + european_union_member: boolean; + time_zone: string; + postal_code: number; + in_privacy_restricted_country: boolean; + in_privacy_restricted_region: boolean; + subdivisions: string; + coordinates: string; +}; + +/** @internal */ +export const GetTokenByPinIdGeoData$outboundSchema: z.ZodType< + GetTokenByPinIdGeoData$Outbound, + z.ZodTypeDef, + GetTokenByPinIdGeoData +> = z + .object({ + code: z.string(), + continentCode: z.string(), + country: z.string(), + city: z.string(), + europeanUnionMember: z.boolean().default(false), + timeZone: z.string(), + postalCode: z.number().int(), + inPrivacyRestrictedCountry: z.boolean().default(false), + inPrivacyRestrictedRegion: z.boolean().default(false), + subdivisions: z.string(), + coordinates: z.string(), + }) + .transform((v) => { + return remap$(v, { + continentCode: "continent_code", + europeanUnionMember: "european_union_member", + timeZone: "time_zone", + postalCode: "postal_code", + inPrivacyRestrictedCountry: "in_privacy_restricted_country", + inPrivacyRestrictedRegion: "in_privacy_restricted_region", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdGeoData$ { + /** @deprecated use `GetTokenByPinIdGeoData$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdGeoData$inboundSchema; + /** @deprecated use `GetTokenByPinIdGeoData$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdGeoData$outboundSchema; + /** @deprecated use `GetTokenByPinIdGeoData$Outbound` instead. */ + export type Outbound = GetTokenByPinIdGeoData$Outbound; +} + +/** @internal */ +export const GetTokenByPinIdAuthPinContainer$inboundSchema: z.ZodType< + GetTokenByPinIdAuthPinContainer, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int(), + code: z.string(), + product: z.string(), + trusted: z.boolean(), + qr: z.string(), + clientIdentifier: z.string(), + location: z.lazy(() => GetTokenByPinIdGeoData$inboundSchema), + expiresIn: z.number().int().default(900), + createdAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)), + expiresAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)), + authToken: z.nullable(z.any()).optional(), + newRegistration: z.nullable(z.any()).optional(), +}); + +/** @internal */ +export type GetTokenByPinIdAuthPinContainer$Outbound = { + id: number; + code: string; + product: string; + trusted: boolean; + qr: string; + clientIdentifier: string; + location: GetTokenByPinIdGeoData$Outbound; + expiresIn: number; + createdAt: string; + expiresAt: string; + authToken?: any | null | undefined; + newRegistration?: any | null | undefined; +}; + +/** @internal */ +export const GetTokenByPinIdAuthPinContainer$outboundSchema: z.ZodType< + GetTokenByPinIdAuthPinContainer$Outbound, + z.ZodTypeDef, + GetTokenByPinIdAuthPinContainer +> = z.object({ + id: z.number().int(), + code: z.string(), + product: z.string(), + trusted: z.boolean().default(false), + qr: z.string(), + clientIdentifier: z.string(), + location: z.lazy(() => GetTokenByPinIdGeoData$outboundSchema), + expiresIn: z.number().int().default(900), + createdAt: z.date().transform((v) => v.toISOString()), + expiresAt: z.date().transform((v) => v.toISOString()), + authToken: z.nullable(z.any()).optional(), + newRegistration: z.nullable(z.any()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdAuthPinContainer$ { + /** @deprecated use `GetTokenByPinIdAuthPinContainer$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdAuthPinContainer$inboundSchema; + /** @deprecated use `GetTokenByPinIdAuthPinContainer$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdAuthPinContainer$outboundSchema; + /** @deprecated use `GetTokenByPinIdAuthPinContainer$Outbound` instead. */ + export type Outbound = GetTokenByPinIdAuthPinContainer$Outbound; +} + +/** @internal */ +export const GetTokenByPinIdResponse$inboundSchema: z.ZodType< + GetTokenByPinIdResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + AuthPinContainer: z.lazy(() => GetTokenByPinIdAuthPinContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + AuthPinContainer: "authPinContainer", + }); + }); + +/** @internal */ +export type GetTokenByPinIdResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + AuthPinContainer?: GetTokenByPinIdAuthPinContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetTokenByPinIdResponse$outboundSchema: z.ZodType< + GetTokenByPinIdResponse$Outbound, + z.ZodTypeDef, + GetTokenByPinIdResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + authPinContainer: z.lazy(() => GetTokenByPinIdAuthPinContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + authPinContainer: "AuthPinContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTokenByPinIdResponse$ { + /** @deprecated use `GetTokenByPinIdResponse$inboundSchema` instead. */ + export const inboundSchema = GetTokenByPinIdResponse$inboundSchema; + /** @deprecated use `GetTokenByPinIdResponse$outboundSchema` instead. */ + export const outboundSchema = GetTokenByPinIdResponse$outboundSchema; + /** @deprecated use `GetTokenByPinIdResponse$Outbound` instead. */ + export type Outbound = GetTokenByPinIdResponse$Outbound; +} diff --git a/src/models/gettokenop.ts b/src/models/gettokenop.ts deleted file mode 100644 index 6f57dfea..00000000 --- a/src/models/gettokenop.ts +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - */ - -import { remap as remap$ } from "../lib/primitives.js"; -import * as z from "zod"; - -export const GetTokenOpServerList = ["https://plex.tv/api/v2"] as const; - -export type GetTokenGlobals = { - /** - * The unique identifier for the client application - * - * @remarks - * This is used to track the client application and its usage - * (UUID, serial number, or other number unique per device) - * - */ - xPlexClientIdentifier?: string | undefined; -}; - -export type GetTokenRequest = { - /** - * The PinID to retrieve an access token for - */ - pinID: string; - /** - * The unique identifier for the client application - * - * @remarks - * This is used to track the client application and its usage - * (UUID, serial number, or other number unique per device) - * - */ - xPlexClientIdentifier?: string | undefined; -}; - -export type GetTokenErrors = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; -}; - -/** - * X-Plex-Client-Identifier is missing - */ -export type GetTokenPlexResponseBodyData = { - errors?: Array | undefined; - /** - * Raw HTTP response; suitable for custom response parsing - */ - rawResponse?: Response | undefined; -}; - -/** - * X-Plex-Client-Identifier is missing - */ -export class GetTokenPlexResponseBody extends Error { - errors?: Array | undefined; - /** - * Raw HTTP response; suitable for custom response parsing - */ - rawResponse?: Response | undefined; - - /** The original data that was passed to this error instance. */ - data$: GetTokenPlexResponseBodyData; - - constructor(err: GetTokenPlexResponseBodyData) { - super(""); - this.data$ = err; - - if (err.errors != null) { - this.errors = err.errors; - } - if (err.rawResponse != null) { - this.rawResponse = err.rawResponse; - } - - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - - this.name = "GetTokenPlexResponseBody"; - } -} - -export type GetTokenLocation = { - code?: string | undefined; - europeanUnionMember?: boolean | undefined; - continentCode?: string | undefined; - country?: string | undefined; - city?: string | undefined; - timeZone?: string | undefined; - postalCode?: string | undefined; - inPrivacyRestrictedCountry?: boolean | undefined; - subdivisions?: string | undefined; - coordinates?: string | undefined; -}; - -/** - * Access Token - */ -export type GetTokenResponseBody = { - /** - * PinID for use with authentication - */ - id?: number | undefined; - code?: string | undefined; - product?: string | undefined; - trusted?: boolean | undefined; - /** - * a link to a QR code hosted on plex.tv - * - * @remarks - * The QR code redirects to the relevant `plex.tv/link` authentication page - * Which then prompts the user for the 4 Digit Link Pin - * - */ - qr?: string | undefined; - clientIdentifier?: string | undefined; - location?: GetTokenLocation | undefined; - expiresIn?: number | undefined; - createdAt?: Date | undefined; - expiresAt?: Date | undefined; - authToken?: string | undefined; - newRegistration?: string | undefined; -}; - -export type GetTokenResponse = { - /** - * HTTP response content type for this operation - */ - contentType: string; - /** - * HTTP response status code for this operation - */ - statusCode: number; - /** - * Raw HTTP response; suitable for custom response parsing - */ - rawResponse: Response; - /** - * Access Token - */ - object?: GetTokenResponseBody | undefined; -}; - -/** @internal */ -export namespace GetTokenGlobals$ { - export const inboundSchema: z.ZodType = z - .object({ - "X-Plex-Client-Identifier": z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - "X-Plex-Client-Identifier": "xPlexClientIdentifier", - }); - }); - - export type Outbound = { - "X-Plex-Client-Identifier"?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - xPlexClientIdentifier: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - xPlexClientIdentifier: "X-Plex-Client-Identifier", - }); - }); -} - -/** @internal */ -export namespace GetTokenRequest$ { - export const inboundSchema: z.ZodType = z - .object({ - pinID: z.string(), - "X-Plex-Client-Identifier": z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - "X-Plex-Client-Identifier": "xPlexClientIdentifier", - }); - }); - - export type Outbound = { - pinID: string; - "X-Plex-Client-Identifier"?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - pinID: z.string(), - xPlexClientIdentifier: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - xPlexClientIdentifier: "X-Plex-Client-Identifier", - }); - }); -} - -/** @internal */ -export namespace GetTokenErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); -} - -/** @internal */ -export namespace GetTokenPlexResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetTokenErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetTokenPlexResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(GetTokenPlexResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetTokenErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace GetTokenLocation$ { - export const inboundSchema: z.ZodType = z - .object({ - code: z.string().optional(), - european_union_member: z.boolean().optional(), - continent_code: z.string().optional(), - country: z.string().optional(), - city: z.string().optional(), - time_zone: z.string().optional(), - postal_code: z.string().optional(), - in_privacy_restricted_country: z.boolean().optional(), - subdivisions: z.string().optional(), - coordinates: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - european_union_member: "europeanUnionMember", - continent_code: "continentCode", - time_zone: "timeZone", - postal_code: "postalCode", - in_privacy_restricted_country: "inPrivacyRestrictedCountry", - }); - }); - - export type Outbound = { - code?: string | undefined; - european_union_member?: boolean | undefined; - continent_code?: string | undefined; - country?: string | undefined; - city?: string | undefined; - time_zone?: string | undefined; - postal_code?: string | undefined; - in_privacy_restricted_country?: boolean | undefined; - subdivisions?: string | undefined; - coordinates?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - code: z.string().optional(), - europeanUnionMember: z.boolean().optional(), - continentCode: z.string().optional(), - country: z.string().optional(), - city: z.string().optional(), - timeZone: z.string().optional(), - postalCode: z.string().optional(), - inPrivacyRestrictedCountry: z.boolean().optional(), - subdivisions: z.string().optional(), - coordinates: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - europeanUnionMember: "european_union_member", - continentCode: "continent_code", - timeZone: "time_zone", - postalCode: "postal_code", - inPrivacyRestrictedCountry: "in_privacy_restricted_country", - }); - }); -} - -/** @internal */ -export namespace GetTokenResponseBody$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().optional(), - code: z.string().optional(), - product: z.string().optional(), - trusted: z.boolean().optional(), - qr: z.string().optional(), - clientIdentifier: z.string().optional(), - location: z.lazy(() => GetTokenLocation$.inboundSchema).optional(), - expiresIn: z.number().optional(), - createdAt: z - .string() - .datetime({ offset: true }) - .transform((v) => new Date(v)) - .optional(), - expiresAt: z - .string() - .datetime({ offset: true }) - .transform((v) => new Date(v)) - .optional(), - authToken: z.string().optional(), - newRegistration: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - code?: string | undefined; - product?: string | undefined; - trusted?: boolean | undefined; - qr?: string | undefined; - clientIdentifier?: string | undefined; - location?: GetTokenLocation$.Outbound | undefined; - expiresIn?: number | undefined; - createdAt?: string | undefined; - expiresAt?: string | undefined; - authToken?: string | undefined; - newRegistration?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object( - { - id: z.number().optional(), - code: z.string().optional(), - product: z.string().optional(), - trusted: z.boolean().optional(), - qr: z.string().optional(), - clientIdentifier: z.string().optional(), - location: z.lazy(() => GetTokenLocation$.outboundSchema).optional(), - expiresIn: z.number().optional(), - createdAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - expiresAt: z - .date() - .transform((v) => v.toISOString()) - .optional(), - authToken: z.string().optional(), - newRegistration: z.string().optional(), - } - ); -} - -/** @internal */ -export namespace GetTokenResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetTokenResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetTokenResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetTokenResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); -} diff --git a/src/models/gettopwatchedcontentop.ts b/src/models/gettopwatchedcontentop.ts index f7dda6fc..193c74e7 100644 --- a/src/models/gettopwatchedcontentop.ts +++ b/src/models/gettopwatchedcontentop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -45,7 +45,7 @@ export type GetTopWatchedContentRole = { thumb?: string | undefined; }; -export type User = { +export type GetTopWatchedContentUser = { id?: number | undefined; }; @@ -81,7 +81,7 @@ export type GetTopWatchedContentMetadata = { country?: Array | undefined; guids?: Array | undefined; role?: Array | undefined; - user?: Array | undefined; + user?: Array | undefined; }; export type GetTopWatchedContentMediaContainer = { @@ -120,393 +120,576 @@ export type GetTopWatchedContentResponse = { }; /** @internal */ +export const GetTopWatchedContentRequest$inboundSchema: z.ZodType< + GetTopWatchedContentRequest, + z.ZodTypeDef, + unknown +> = z.object({ + type: z.number().int(), + includeGuids: z.number().int().optional(), +}); + +/** @internal */ +export type GetTopWatchedContentRequest$Outbound = { + type: number; + includeGuids?: number | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentRequest$outboundSchema: z.ZodType< + GetTopWatchedContentRequest$Outbound, + z.ZodTypeDef, + GetTopWatchedContentRequest +> = z.object({ + type: z.number().int(), + includeGuids: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - type: z.number().int(), - includeGuids: z.number().int().optional(), - }); - - export type Outbound = { - type: number; - includeGuids?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - type: z.number().int(), - includeGuids: z.number().int().optional(), - }); + /** @deprecated use `GetTopWatchedContentRequest$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentRequest$inboundSchema; + /** @deprecated use `GetTopWatchedContentRequest$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentRequest$outboundSchema; + /** @deprecated use `GetTopWatchedContentRequest$Outbound` instead. */ + export type Outbound = GetTopWatchedContentRequest$Outbound; } /** @internal */ +export const GetTopWatchedContentGenre$inboundSchema: z.ZodType< + GetTopWatchedContentGenre, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** @internal */ +export type GetTopWatchedContentGenre$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentGenre$outboundSchema: z.ZodType< + GetTopWatchedContentGenre$Outbound, + z.ZodTypeDef, + GetTopWatchedContentGenre +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentGenre$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); + /** @deprecated use `GetTopWatchedContentGenre$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentGenre$inboundSchema; + /** @deprecated use `GetTopWatchedContentGenre$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentGenre$outboundSchema; + /** @deprecated use `GetTopWatchedContentGenre$Outbound` instead. */ + export type Outbound = GetTopWatchedContentGenre$Outbound; } /** @internal */ +export const GetTopWatchedContentCountry$inboundSchema: z.ZodType< + GetTopWatchedContentCountry, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** @internal */ +export type GetTopWatchedContentCountry$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentCountry$outboundSchema: z.ZodType< + GetTopWatchedContentCountry$Outbound, + z.ZodTypeDef, + GetTopWatchedContentCountry +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentCountry$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - }); + /** @deprecated use `GetTopWatchedContentCountry$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentCountry$inboundSchema; + /** @deprecated use `GetTopWatchedContentCountry$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentCountry$outboundSchema; + /** @deprecated use `GetTopWatchedContentCountry$Outbound` instead. */ + export type Outbound = GetTopWatchedContentCountry$Outbound; } /** @internal */ +export const GetTopWatchedContentGuids$inboundSchema: z.ZodType< + GetTopWatchedContentGuids, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.string().optional(), +}); + +/** @internal */ +export type GetTopWatchedContentGuids$Outbound = { + id?: string | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentGuids$outboundSchema: z.ZodType< + GetTopWatchedContentGuids$Outbound, + z.ZodTypeDef, + GetTopWatchedContentGuids +> = z.object({ + id: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentGuids$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.string().optional(), - }); - - export type Outbound = { - id?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.string().optional(), - }); + /** @deprecated use `GetTopWatchedContentGuids$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentGuids$inboundSchema; + /** @deprecated use `GetTopWatchedContentGuids$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentGuids$outboundSchema; + /** @deprecated use `GetTopWatchedContentGuids$Outbound` instead. */ + export type Outbound = GetTopWatchedContentGuids$Outbound; } /** @internal */ +export const GetTopWatchedContentRole$inboundSchema: z.ZodType< + GetTopWatchedContentRole, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + role: z.string().optional(), + thumb: z.string().optional(), +}); + +/** @internal */ +export type GetTopWatchedContentRole$Outbound = { + id?: number | undefined; + filter?: string | undefined; + tag?: string | undefined; + tagKey?: string | undefined; + role?: string | undefined; + thumb?: string | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentRole$outboundSchema: z.ZodType< + GetTopWatchedContentRole$Outbound, + z.ZodTypeDef, + GetTopWatchedContentRole +> = z.object({ + id: z.number().int().optional(), + filter: z.string().optional(), + tag: z.string().optional(), + tagKey: z.string().optional(), + role: z.string().optional(), + thumb: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentRole$ { - export const inboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - role: z.string().optional(), - thumb: z.string().optional(), - }); - - export type Outbound = { - id?: number | undefined; - filter?: string | undefined; - tag?: string | undefined; - tagKey?: string | undefined; - role?: string | undefined; - thumb?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - id: z.number().int().optional(), - filter: z.string().optional(), - tag: z.string().optional(), - tagKey: z.string().optional(), - role: z.string().optional(), - thumb: z.string().optional(), - }); + /** @deprecated use `GetTopWatchedContentRole$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentRole$inboundSchema; + /** @deprecated use `GetTopWatchedContentRole$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentRole$outboundSchema; + /** @deprecated use `GetTopWatchedContentRole$Outbound` instead. */ + export type Outbound = GetTopWatchedContentRole$Outbound; } /** @internal */ -export namespace User$ { - export const inboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - }); +export const GetTopWatchedContentUser$inboundSchema: z.ZodType< + GetTopWatchedContentUser, + z.ZodTypeDef, + unknown +> = z.object({ + id: z.number().int().optional(), +}); - export type Outbound = { - id?: number | undefined; - }; +/** @internal */ +export type GetTopWatchedContentUser$Outbound = { + id?: number | undefined; +}; - export const outboundSchema: z.ZodType = z.object({ - id: z.number().int().optional(), - }); +/** @internal */ +export const GetTopWatchedContentUser$outboundSchema: z.ZodType< + GetTopWatchedContentUser$Outbound, + z.ZodTypeDef, + GetTopWatchedContentUser +> = z.object({ + id: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTopWatchedContentUser$ { + /** @deprecated use `GetTopWatchedContentUser$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentUser$inboundSchema; + /** @deprecated use `GetTopWatchedContentUser$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentUser$outboundSchema; + /** @deprecated use `GetTopWatchedContentUser$Outbound` instead. */ + export type Outbound = GetTopWatchedContentUser$Outbound; } /** @internal */ +export const GetTopWatchedContentMetadata$inboundSchema: z.ZodType< + GetTopWatchedContentMetadata, + z.ZodTypeDef, + unknown +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + slug: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + index: z.number().int().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + leafCount: z.number().int().optional(), + viewedLeafCount: z.number().int().optional(), + childCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + globalViewCount: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + Genre: z.array(z.lazy(() => GetTopWatchedContentGenre$inboundSchema)).optional(), + Country: z.array(z.lazy(() => GetTopWatchedContentCountry$inboundSchema)).optional(), + Guid: z.array(z.lazy(() => GetTopWatchedContentGuids$inboundSchema)).optional(), + Role: z.array(z.lazy(() => GetTopWatchedContentRole$inboundSchema)).optional(), + User: z.array(z.lazy(() => GetTopWatchedContentUser$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Genre: "genre", + Country: "country", + Guid: "guids", + Role: "role", + User: "user", + }); + }); + +/** @internal */ +export type GetTopWatchedContentMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + guid?: string | undefined; + slug?: string | undefined; + studio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + librarySectionTitle?: string | undefined; + librarySectionID?: number | undefined; + librarySectionKey?: string | undefined; + contentRating?: string | undefined; + summary?: string | undefined; + index?: number | undefined; + audienceRating?: number | undefined; + year?: number | undefined; + tagline?: string | undefined; + thumb?: string | undefined; + art?: string | undefined; + duration?: number | undefined; + originallyAvailableAt?: string | undefined; + leafCount?: number | undefined; + viewedLeafCount?: number | undefined; + childCount?: number | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; + globalViewCount?: number | undefined; + audienceRatingImage?: string | undefined; + Genre?: Array | undefined; + Country?: Array | undefined; + Guid?: Array | undefined; + Role?: Array | undefined; + User?: Array | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentMetadata$outboundSchema: z.ZodType< + GetTopWatchedContentMetadata$Outbound, + z.ZodTypeDef, + GetTopWatchedContentMetadata +> = z + .object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + guid: z.string().optional(), + slug: z.string().optional(), + studio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + librarySectionTitle: z.string().optional(), + librarySectionID: z.number().int().optional(), + librarySectionKey: z.string().optional(), + contentRating: z.string().optional(), + summary: z.string().optional(), + index: z.number().int().optional(), + audienceRating: z.number().optional(), + year: z.number().int().optional(), + tagline: z.string().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + duration: z.number().int().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + leafCount: z.number().int().optional(), + viewedLeafCount: z.number().int().optional(), + childCount: z.number().int().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + globalViewCount: z.number().int().optional(), + audienceRatingImage: z.string().optional(), + genre: z.array(z.lazy(() => GetTopWatchedContentGenre$outboundSchema)).optional(), + country: z.array(z.lazy(() => GetTopWatchedContentCountry$outboundSchema)).optional(), + guids: z.array(z.lazy(() => GetTopWatchedContentGuids$outboundSchema)).optional(), + role: z.array(z.lazy(() => GetTopWatchedContentRole$outboundSchema)).optional(), + user: z.array(z.lazy(() => GetTopWatchedContentUser$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + genre: "Genre", + country: "Country", + guids: "Guid", + role: "Role", + user: "User", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentMetadata$ { - export const inboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - slug: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - index: z.number().int().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - leafCount: z.number().int().optional(), - viewedLeafCount: z.number().int().optional(), - childCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - globalViewCount: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - Genre: z.array(z.lazy(() => GetTopWatchedContentGenre$.inboundSchema)).optional(), - Country: z.array(z.lazy(() => GetTopWatchedContentCountry$.inboundSchema)).optional(), - guids: z.array(z.lazy(() => GetTopWatchedContentGuids$.inboundSchema)).optional(), - Role: z.array(z.lazy(() => GetTopWatchedContentRole$.inboundSchema)).optional(), - User: z.array(z.lazy(() => User$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Genre: "genre", - Country: "country", - Role: "role", - User: "user", - }); - }); - - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - guid?: string | undefined; - slug?: string | undefined; - studio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - librarySectionTitle?: string | undefined; - librarySectionID?: number | undefined; - librarySectionKey?: string | undefined; - contentRating?: string | undefined; - summary?: string | undefined; - index?: number | undefined; - audienceRating?: number | undefined; - year?: number | undefined; - tagline?: string | undefined; - thumb?: string | undefined; - art?: string | undefined; - duration?: number | undefined; - originallyAvailableAt?: string | undefined; - leafCount?: number | undefined; - viewedLeafCount?: number | undefined; - childCount?: number | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - globalViewCount?: number | undefined; - audienceRatingImage?: string | undefined; - Genre?: Array | undefined; - Country?: Array | undefined; - guids?: Array | undefined; - Role?: Array | undefined; - User?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - guid: z.string().optional(), - slug: z.string().optional(), - studio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - librarySectionTitle: z.string().optional(), - librarySectionID: z.number().int().optional(), - librarySectionKey: z.string().optional(), - contentRating: z.string().optional(), - summary: z.string().optional(), - index: z.number().int().optional(), - audienceRating: z.number().optional(), - year: z.number().int().optional(), - tagline: z.string().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - duration: z.number().int().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - leafCount: z.number().int().optional(), - viewedLeafCount: z.number().int().optional(), - childCount: z.number().int().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - globalViewCount: z.number().int().optional(), - audienceRatingImage: z.string().optional(), - genre: z.array(z.lazy(() => GetTopWatchedContentGenre$.outboundSchema)).optional(), - country: z.array(z.lazy(() => GetTopWatchedContentCountry$.outboundSchema)).optional(), - guids: z.array(z.lazy(() => GetTopWatchedContentGuids$.outboundSchema)).optional(), - role: z.array(z.lazy(() => GetTopWatchedContentRole$.outboundSchema)).optional(), - user: z.array(z.lazy(() => User$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - genre: "Genre", - country: "Country", - role: "Role", - user: "User", - }); - }); + /** @deprecated use `GetTopWatchedContentMetadata$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentMetadata$inboundSchema; + /** @deprecated use `GetTopWatchedContentMetadata$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentMetadata$outboundSchema; + /** @deprecated use `GetTopWatchedContentMetadata$Outbound` instead. */ + export type Outbound = GetTopWatchedContentMetadata$Outbound; } /** @internal */ +export const GetTopWatchedContentMediaContainer$inboundSchema: z.ZodType< + GetTopWatchedContentMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + Metadata: z.array(z.lazy(() => GetTopWatchedContentMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetTopWatchedContentMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + identifier?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentMediaContainer$outboundSchema: z.ZodType< + GetTopWatchedContentMediaContainer$Outbound, + z.ZodTypeDef, + GetTopWatchedContentMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + metadata: z.array(z.lazy(() => GetTopWatchedContentMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentMediaContainer$ { - export const inboundSchema: z.ZodType< - GetTopWatchedContentMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - Metadata: z.array(z.lazy(() => GetTopWatchedContentMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - identifier?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetTopWatchedContentMediaContainer - > = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - metadata: z - .array(z.lazy(() => GetTopWatchedContentMetadata$.outboundSchema)) - .optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetTopWatchedContentMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentMediaContainer$inboundSchema; + /** @deprecated use `GetTopWatchedContentMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentMediaContainer$outboundSchema; + /** @deprecated use `GetTopWatchedContentMediaContainer$Outbound` instead. */ + export type Outbound = GetTopWatchedContentMediaContainer$Outbound; } /** @internal */ +export const GetTopWatchedContentResponseBody$inboundSchema: z.ZodType< + GetTopWatchedContentResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetTopWatchedContentMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetTopWatchedContentResponseBody$Outbound = { + MediaContainer?: GetTopWatchedContentMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentResponseBody$outboundSchema: z.ZodType< + GetTopWatchedContentResponseBody$Outbound, + z.ZodTypeDef, + GetTopWatchedContentResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetTopWatchedContentMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentResponseBody$ { - export const inboundSchema: z.ZodType = - z - .object({ - MediaContainer: z - .lazy(() => GetTopWatchedContentMediaContainer$.inboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetTopWatchedContentMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetTopWatchedContentResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetTopWatchedContentMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetTopWatchedContentResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentResponseBody$inboundSchema; + /** @deprecated use `GetTopWatchedContentResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentResponseBody$outboundSchema; + /** @deprecated use `GetTopWatchedContentResponseBody$Outbound` instead. */ + export type Outbound = GetTopWatchedContentResponseBody$Outbound; } /** @internal */ +export const GetTopWatchedContentResponse$inboundSchema: z.ZodType< + GetTopWatchedContentResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetTopWatchedContentResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetTopWatchedContentResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetTopWatchedContentResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetTopWatchedContentResponse$outboundSchema: z.ZodType< + GetTopWatchedContentResponse$Outbound, + z.ZodTypeDef, + GetTopWatchedContentResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetTopWatchedContentResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTopWatchedContentResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetTopWatchedContentResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetTopWatchedContentResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetTopWatchedContentResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetTopWatchedContentResponse$inboundSchema` instead. */ + export const inboundSchema = GetTopWatchedContentResponse$inboundSchema; + /** @deprecated use `GetTopWatchedContentResponse$outboundSchema` instead. */ + export const outboundSchema = GetTopWatchedContentResponse$outboundSchema; + /** @deprecated use `GetTopWatchedContentResponse$Outbound` instead. */ + export type Outbound = GetTopWatchedContentResponse$Outbound; } diff --git a/src/models/gettranscodesessionsop.ts b/src/models/gettranscodesessionsop.ts index 31d9acd5..4b2c960a 100644 --- a/src/models/gettranscodesessionsop.ts +++ b/src/models/gettranscodesessionsop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetTranscodeSessionsSessionsResponseBody extends Error { data$: GetTranscodeSessionsSessionsResponseBodyData; constructor(err: GetTranscodeSessionsSessionsResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetTranscodeSessionsSessionsResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetTranscodeSessionsSessionsResponseBody"; } } @@ -114,276 +113,370 @@ export type GetTranscodeSessionsResponse = { }; /** @internal */ +export const GetTranscodeSessionsErrors$inboundSchema: z.ZodType< + GetTranscodeSessionsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetTranscodeSessionsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetTranscodeSessionsErrors$outboundSchema: z.ZodType< + GetTranscodeSessionsErrors$Outbound, + z.ZodTypeDef, + GetTranscodeSessionsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTranscodeSessionsErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetTranscodeSessionsErrors$inboundSchema` instead. */ + export const inboundSchema = GetTranscodeSessionsErrors$inboundSchema; + /** @deprecated use `GetTranscodeSessionsErrors$outboundSchema` instead. */ + export const outboundSchema = GetTranscodeSessionsErrors$outboundSchema; + /** @deprecated use `GetTranscodeSessionsErrors$Outbound` instead. */ + export type Outbound = GetTranscodeSessionsErrors$Outbound; } /** @internal */ -export namespace GetTranscodeSessionsSessionsResponseBody$ { - export const inboundSchema: z.ZodType< - GetTranscodeSessionsSessionsResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetTranscodeSessionsErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetTranscodeSessionsSessionsResponseBody(remapped); +export const GetTranscodeSessionsSessionsResponseBody$inboundSchema: z.ZodType< + GetTranscodeSessionsSessionsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetTranscodeSessionsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetTranscodeSessionsSessionsResponseBody - > = z - .instanceof(GetTranscodeSessionsSessionsResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetTranscodeSessionsErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace TranscodeSession$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - throttled: z.boolean().optional(), - complete: z.boolean().optional(), - progress: z.number().optional(), - size: z.number().int().optional(), - speed: z.number().optional(), - error: z.boolean().optional(), - duration: z.number().int().optional(), - remaining: z.number().int().optional(), - context: z.string().optional(), - sourceVideoCodec: z.string().optional(), - sourceAudioCodec: z.string().optional(), - videoDecision: z.string().optional(), - audioDecision: z.string().optional(), - subtitleDecision: z.string().optional(), - protocol: z.string().optional(), - container: z.string().optional(), - videoCodec: z.string().optional(), - audioCodec: z.string().optional(), - audioChannels: z.number().int().optional(), - transcodeHwRequested: z.boolean().optional(), - timeStamp: z.number().optional(), - maxOffsetAvailable: z.number().optional(), - minOffsetAvailable: z.number().optional(), + return new GetTranscodeSessionsSessionsResponseBody(remapped); }); - export type Outbound = { - key?: string | undefined; - throttled?: boolean | undefined; - complete?: boolean | undefined; - progress?: number | undefined; - size?: number | undefined; - speed?: number | undefined; - error?: boolean | undefined; - duration?: number | undefined; - remaining?: number | undefined; - context?: string | undefined; - sourceVideoCodec?: string | undefined; - sourceAudioCodec?: string | undefined; - videoDecision?: string | undefined; - audioDecision?: string | undefined; - subtitleDecision?: string | undefined; - protocol?: string | undefined; - container?: string | undefined; - videoCodec?: string | undefined; - audioCodec?: string | undefined; - audioChannels?: number | undefined; - transcodeHwRequested?: boolean | undefined; - timeStamp?: number | undefined; - maxOffsetAvailable?: number | undefined; - minOffsetAvailable?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - throttled: z.boolean().optional(), - complete: z.boolean().optional(), - progress: z.number().optional(), - size: z.number().int().optional(), - speed: z.number().optional(), - error: z.boolean().optional(), - duration: z.number().int().optional(), - remaining: z.number().int().optional(), - context: z.string().optional(), - sourceVideoCodec: z.string().optional(), - sourceAudioCodec: z.string().optional(), - videoDecision: z.string().optional(), - audioDecision: z.string().optional(), - subtitleDecision: z.string().optional(), - protocol: z.string().optional(), - container: z.string().optional(), - videoCodec: z.string().optional(), - audioCodec: z.string().optional(), - audioChannels: z.number().int().optional(), - transcodeHwRequested: z.boolean().optional(), - timeStamp: z.number().optional(), - maxOffsetAvailable: z.number().optional(), - minOffsetAvailable: z.number().optional(), - }); -} +/** @internal */ +export type GetTranscodeSessionsSessionsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetTranscodeSessionsMediaContainer$ { - export const inboundSchema: z.ZodType< - GetTranscodeSessionsMediaContainer, - z.ZodTypeDef, - unknown - > = z - .object({ - size: z.number().int().optional(), - TranscodeSession: z.array(z.lazy(() => TranscodeSession$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - TranscodeSession: "transcodeSession", - }); - }); - - export type Outbound = { - size?: number | undefined; - TranscodeSession?: Array | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetTranscodeSessionsMediaContainer - > = z - .object({ - size: z.number().int().optional(), - transcodeSession: z.array(z.lazy(() => TranscodeSession$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - transcodeSession: "TranscodeSession", - }); - }); -} - -/** @internal */ -export namespace GetTranscodeSessionsResponseBody$ { - export const inboundSchema: z.ZodType = +export const GetTranscodeSessionsSessionsResponseBody$outboundSchema: z.ZodType< + GetTranscodeSessionsSessionsResponseBody$Outbound, + z.ZodTypeDef, + GetTranscodeSessionsSessionsResponseBody +> = z + .instanceof(GetTranscodeSessionsSessionsResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - MediaContainer: z - .lazy(() => GetTranscodeSessionsMediaContainer$.inboundSchema) + errors: z.array(z.lazy(() => GetTranscodeSessionsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) .optional(), }) .transform((v) => { return remap$(v, { - MediaContainer: "mediaContainer", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - MediaContainer?: GetTranscodeSessionsMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetTranscodeSessionsResponseBody - > = z - .object({ - mediaContainer: z - .lazy(() => GetTranscodeSessionsMediaContainer$.outboundSchema) - .optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTranscodeSessionsSessionsResponseBody$ { + /** @deprecated use `GetTranscodeSessionsSessionsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetTranscodeSessionsSessionsResponseBody$inboundSchema; + /** @deprecated use `GetTranscodeSessionsSessionsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetTranscodeSessionsSessionsResponseBody$outboundSchema; + /** @deprecated use `GetTranscodeSessionsSessionsResponseBody$Outbound` instead. */ + export type Outbound = GetTranscodeSessionsSessionsResponseBody$Outbound; } /** @internal */ -export namespace GetTranscodeSessionsResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetTranscodeSessionsResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); +export const TranscodeSession$inboundSchema: z.ZodType = + z.object({ + key: z.string().optional(), + throttled: z.boolean().optional(), + complete: z.boolean().optional(), + progress: z.number().optional(), + size: z.number().int().optional(), + speed: z.number().optional(), + error: z.boolean().optional(), + duration: z.number().int().optional(), + remaining: z.number().int().optional(), + context: z.string().optional(), + sourceVideoCodec: z.string().optional(), + sourceAudioCodec: z.string().optional(), + videoDecision: z.string().optional(), + audioDecision: z.string().optional(), + subtitleDecision: z.string().optional(), + protocol: z.string().optional(), + container: z.string().optional(), + videoCodec: z.string().optional(), + audioCodec: z.string().optional(), + audioChannels: z.number().int().optional(), + transcodeHwRequested: z.boolean().optional(), + timeStamp: z.number().optional(), + maxOffsetAvailable: z.number().optional(), + minOffsetAvailable: z.number().optional(), + }); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetTranscodeSessionsResponseBody$.Outbound | undefined; - }; +/** @internal */ +export type TranscodeSession$Outbound = { + key?: string | undefined; + throttled?: boolean | undefined; + complete?: boolean | undefined; + progress?: number | undefined; + size?: number | undefined; + speed?: number | undefined; + error?: boolean | undefined; + duration?: number | undefined; + remaining?: number | undefined; + context?: string | undefined; + sourceVideoCodec?: string | undefined; + sourceAudioCodec?: string | undefined; + videoDecision?: string | undefined; + audioDecision?: string | undefined; + subtitleDecision?: string | undefined; + protocol?: string | undefined; + container?: string | undefined; + videoCodec?: string | undefined; + audioCodec?: string | undefined; + audioChannels?: number | undefined; + transcodeHwRequested?: boolean | undefined; + timeStamp?: number | undefined; + maxOffsetAvailable?: number | undefined; + minOffsetAvailable?: number | undefined; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetTranscodeSessionsResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** @internal */ +export const TranscodeSession$outboundSchema: z.ZodType< + TranscodeSession$Outbound, + z.ZodTypeDef, + TranscodeSession +> = z.object({ + key: z.string().optional(), + throttled: z.boolean().optional(), + complete: z.boolean().optional(), + progress: z.number().optional(), + size: z.number().int().optional(), + speed: z.number().optional(), + error: z.boolean().optional(), + duration: z.number().int().optional(), + remaining: z.number().int().optional(), + context: z.string().optional(), + sourceVideoCodec: z.string().optional(), + sourceAudioCodec: z.string().optional(), + videoDecision: z.string().optional(), + audioDecision: z.string().optional(), + subtitleDecision: z.string().optional(), + protocol: z.string().optional(), + container: z.string().optional(), + videoCodec: z.string().optional(), + audioCodec: z.string().optional(), + audioChannels: z.number().int().optional(), + transcodeHwRequested: z.boolean().optional(), + timeStamp: z.number().optional(), + maxOffsetAvailable: z.number().optional(), + minOffsetAvailable: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TranscodeSession$ { + /** @deprecated use `TranscodeSession$inboundSchema` instead. */ + export const inboundSchema = TranscodeSession$inboundSchema; + /** @deprecated use `TranscodeSession$outboundSchema` instead. */ + export const outboundSchema = TranscodeSession$outboundSchema; + /** @deprecated use `TranscodeSession$Outbound` instead. */ + export type Outbound = TranscodeSession$Outbound; +} + +/** @internal */ +export const GetTranscodeSessionsMediaContainer$inboundSchema: z.ZodType< + GetTranscodeSessionsMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + TranscodeSession: z.array(z.lazy(() => TranscodeSession$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + TranscodeSession: "transcodeSession", + }); + }); + +/** @internal */ +export type GetTranscodeSessionsMediaContainer$Outbound = { + size?: number | undefined; + TranscodeSession?: Array | undefined; +}; + +/** @internal */ +export const GetTranscodeSessionsMediaContainer$outboundSchema: z.ZodType< + GetTranscodeSessionsMediaContainer$Outbound, + z.ZodTypeDef, + GetTranscodeSessionsMediaContainer +> = z + .object({ + size: z.number().int().optional(), + transcodeSession: z.array(z.lazy(() => TranscodeSession$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + transcodeSession: "TranscodeSession", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTranscodeSessionsMediaContainer$ { + /** @deprecated use `GetTranscodeSessionsMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetTranscodeSessionsMediaContainer$inboundSchema; + /** @deprecated use `GetTranscodeSessionsMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetTranscodeSessionsMediaContainer$outboundSchema; + /** @deprecated use `GetTranscodeSessionsMediaContainer$Outbound` instead. */ + export type Outbound = GetTranscodeSessionsMediaContainer$Outbound; +} + +/** @internal */ +export const GetTranscodeSessionsResponseBody$inboundSchema: z.ZodType< + GetTranscodeSessionsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetTranscodeSessionsMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetTranscodeSessionsResponseBody$Outbound = { + MediaContainer?: GetTranscodeSessionsMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetTranscodeSessionsResponseBody$outboundSchema: z.ZodType< + GetTranscodeSessionsResponseBody$Outbound, + z.ZodTypeDef, + GetTranscodeSessionsResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetTranscodeSessionsMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTranscodeSessionsResponseBody$ { + /** @deprecated use `GetTranscodeSessionsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetTranscodeSessionsResponseBody$inboundSchema; + /** @deprecated use `GetTranscodeSessionsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetTranscodeSessionsResponseBody$outboundSchema; + /** @deprecated use `GetTranscodeSessionsResponseBody$Outbound` instead. */ + export type Outbound = GetTranscodeSessionsResponseBody$Outbound; +} + +/** @internal */ +export const GetTranscodeSessionsResponse$inboundSchema: z.ZodType< + GetTranscodeSessionsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetTranscodeSessionsResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetTranscodeSessionsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetTranscodeSessionsResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetTranscodeSessionsResponse$outboundSchema: z.ZodType< + GetTranscodeSessionsResponse$Outbound, + z.ZodTypeDef, + GetTranscodeSessionsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetTranscodeSessionsResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTranscodeSessionsResponse$ { + /** @deprecated use `GetTranscodeSessionsResponse$inboundSchema` instead. */ + export const inboundSchema = GetTranscodeSessionsResponse$inboundSchema; + /** @deprecated use `GetTranscodeSessionsResponse$outboundSchema` instead. */ + export const outboundSchema = GetTranscodeSessionsResponse$outboundSchema; + /** @deprecated use `GetTranscodeSessionsResponse$Outbound` instead. */ + export type Outbound = GetTranscodeSessionsResponse$Outbound; } diff --git a/src/models/gettransienttokenop.ts b/src/models/gettransienttokenop.ts index 978fbea6..fefcfb39 100644 --- a/src/models/gettransienttokenop.ts +++ b/src/models/gettransienttokenop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -61,7 +61,11 @@ export class GetTransientTokenResponseBody extends Error { data$: GetTransientTokenResponseBodyData; constructor(err: GetTransientTokenResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -71,11 +75,6 @@ export class GetTransientTokenResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetTransientTokenResponseBody"; } } @@ -96,142 +95,243 @@ export type GetTransientTokenResponse = { }; /** @internal */ +export const GetTransientTokenQueryParamType$inboundSchema: z.ZodNativeEnum< + typeof GetTransientTokenQueryParamType +> = z.nativeEnum(GetTransientTokenQueryParamType); + +/** @internal */ +export const GetTransientTokenQueryParamType$outboundSchema: z.ZodNativeEnum< + typeof GetTransientTokenQueryParamType +> = GetTransientTokenQueryParamType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTransientTokenQueryParamType$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(GetTransientTokenQueryParamType); - export const outboundSchema: z.ZodNativeEnum = - inboundSchema; + /** @deprecated use `GetTransientTokenQueryParamType$inboundSchema` instead. */ + export const inboundSchema = GetTransientTokenQueryParamType$inboundSchema; + /** @deprecated use `GetTransientTokenQueryParamType$outboundSchema` instead. */ + export const outboundSchema = GetTransientTokenQueryParamType$outboundSchema; } /** @internal */ +export const Scope$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Scope); + +/** @internal */ +export const Scope$outboundSchema: z.ZodNativeEnum = Scope$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Scope$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Scope); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Scope$inboundSchema` instead. */ + export const inboundSchema = Scope$inboundSchema; + /** @deprecated use `Scope$outboundSchema` instead. */ + export const outboundSchema = Scope$outboundSchema; } /** @internal */ +export const GetTransientTokenRequest$inboundSchema: z.ZodType< + GetTransientTokenRequest, + z.ZodTypeDef, + unknown +> = z.object({ + type: GetTransientTokenQueryParamType$inboundSchema, + scope: Scope$inboundSchema, +}); + +/** @internal */ +export type GetTransientTokenRequest$Outbound = { + type: string; + scope: string; +}; + +/** @internal */ +export const GetTransientTokenRequest$outboundSchema: z.ZodType< + GetTransientTokenRequest$Outbound, + z.ZodTypeDef, + GetTransientTokenRequest +> = z.object({ + type: GetTransientTokenQueryParamType$outboundSchema, + scope: Scope$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTransientTokenRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - type: GetTransientTokenQueryParamType$.inboundSchema, - scope: Scope$.inboundSchema, - }); - - export type Outbound = { - type: string; - scope: string; - }; - - export const outboundSchema: z.ZodType = - z.object({ - type: GetTransientTokenQueryParamType$.outboundSchema, - scope: Scope$.outboundSchema, - }); + /** @deprecated use `GetTransientTokenRequest$inboundSchema` instead. */ + export const inboundSchema = GetTransientTokenRequest$inboundSchema; + /** @deprecated use `GetTransientTokenRequest$outboundSchema` instead. */ + export const outboundSchema = GetTransientTokenRequest$outboundSchema; + /** @deprecated use `GetTransientTokenRequest$Outbound` instead. */ + export type Outbound = GetTransientTokenRequest$Outbound; } /** @internal */ +export const GetTransientTokenErrors$inboundSchema: z.ZodType< + GetTransientTokenErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetTransientTokenErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetTransientTokenErrors$outboundSchema: z.ZodType< + GetTransientTokenErrors$Outbound, + z.ZodTypeDef, + GetTransientTokenErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTransientTokenErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetTransientTokenErrors$inboundSchema` instead. */ + export const inboundSchema = GetTransientTokenErrors$inboundSchema; + /** @deprecated use `GetTransientTokenErrors$outboundSchema` instead. */ + export const outboundSchema = GetTransientTokenErrors$outboundSchema; + /** @deprecated use `GetTransientTokenErrors$Outbound` instead. */ + export type Outbound = GetTransientTokenErrors$Outbound; } /** @internal */ -export namespace GetTransientTokenResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => GetTransientTokenErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetTransientTokenResponseBody(remapped); +export const GetTransientTokenResponseBody$inboundSchema: z.ZodType< + GetTransientTokenResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetTransientTokenErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new GetTransientTokenResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type GetTransientTokenResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetTransientTokenResponseBody$outboundSchema: z.ZodType< + GetTransientTokenResponseBody$Outbound, + z.ZodTypeDef, + GetTransientTokenResponseBody +> = z + .instanceof(GetTransientTokenResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(GetTransientTokenResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => GetTransientTokenErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => GetTransientTokenErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTransientTokenResponseBody$ { + /** @deprecated use `GetTransientTokenResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetTransientTokenResponseBody$inboundSchema; + /** @deprecated use `GetTransientTokenResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetTransientTokenResponseBody$outboundSchema; + /** @deprecated use `GetTransientTokenResponseBody$Outbound` instead. */ + export type Outbound = GetTransientTokenResponseBody$Outbound; } /** @internal */ +export const GetTransientTokenResponse$inboundSchema: z.ZodType< + GetTransientTokenResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetTransientTokenResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const GetTransientTokenResponse$outboundSchema: z.ZodType< + GetTransientTokenResponse$Outbound, + z.ZodTypeDef, + GetTransientTokenResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetTransientTokenResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetTransientTokenResponse$inboundSchema` instead. */ + export const inboundSchema = GetTransientTokenResponse$inboundSchema; + /** @deprecated use `GetTransientTokenResponse$outboundSchema` instead. */ + export const outboundSchema = GetTransientTokenResponse$outboundSchema; + /** @deprecated use `GetTransientTokenResponse$Outbound` instead. */ + export type Outbound = GetTransientTokenResponse$Outbound; } diff --git a/src/models/getupdatestatusop.ts b/src/models/getupdatestatusop.ts index 0370159a..191d3730 100644 --- a/src/models/getupdatestatusop.ts +++ b/src/models/getupdatestatusop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class GetUpdateStatusUpdaterResponseBody extends Error { data$: GetUpdateStatusUpdaterResponseBodyData; constructor(err: GetUpdateStatusUpdaterResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class GetUpdateStatusUpdaterResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetUpdateStatusUpdaterResponseBody"; } } @@ -100,215 +99,323 @@ export type GetUpdateStatusResponse = { }; /** @internal */ +export const GetUpdateStatusErrors$inboundSchema: z.ZodType< + GetUpdateStatusErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetUpdateStatusErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetUpdateStatusErrors$outboundSchema: z.ZodType< + GetUpdateStatusErrors$Outbound, + z.ZodTypeDef, + GetUpdateStatusErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetUpdateStatusErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetUpdateStatusErrors$inboundSchema` instead. */ + export const inboundSchema = GetUpdateStatusErrors$inboundSchema; + /** @deprecated use `GetUpdateStatusErrors$outboundSchema` instead. */ + export const outboundSchema = GetUpdateStatusErrors$outboundSchema; + /** @deprecated use `GetUpdateStatusErrors$Outbound` instead. */ + export type Outbound = GetUpdateStatusErrors$Outbound; } /** @internal */ -export namespace GetUpdateStatusUpdaterResponseBody$ { - export const inboundSchema: z.ZodType< - GetUpdateStatusUpdaterResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetUpdateStatusErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetUpdateStatusUpdaterResponseBody(remapped); +export const GetUpdateStatusUpdaterResponseBody$inboundSchema: z.ZodType< + GetUpdateStatusUpdaterResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetUpdateStatusErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetUpdateStatusUpdaterResponseBody - > = z - .instanceof(GetUpdateStatusUpdaterResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetUpdateStatusErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} - -/** @internal */ -export namespace Release$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - version: z.string().optional(), - added: z.string().optional(), - fixed: z.string().optional(), - downloadURL: z.string().optional(), - state: z.string().optional(), + return new GetUpdateStatusUpdaterResponseBody(remapped); }); - export type Outbound = { - key?: string | undefined; - version?: string | undefined; - added?: string | undefined; - fixed?: string | undefined; - downloadURL?: string | undefined; - state?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.string().optional(), - version: z.string().optional(), - added: z.string().optional(), - fixed: z.string().optional(), - downloadURL: z.string().optional(), - state: z.string().optional(), - }); -} +/** @internal */ +export type GetUpdateStatusUpdaterResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; /** @internal */ -export namespace GetUpdateStatusMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - canInstall: z.boolean().optional(), - checkedAt: z.number().int().optional(), - downloadURL: z.string().optional(), - status: z.number().int().optional(), - Release: z.array(z.lazy(() => Release$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Release: "release", - }); - }); - - export type Outbound = { - size?: number | undefined; - canInstall?: boolean | undefined; - checkedAt?: number | undefined; - downloadURL?: string | undefined; - status?: number | undefined; - Release?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = +export const GetUpdateStatusUpdaterResponseBody$outboundSchema: z.ZodType< + GetUpdateStatusUpdaterResponseBody$Outbound, + z.ZodTypeDef, + GetUpdateStatusUpdaterResponseBody +> = z + .instanceof(GetUpdateStatusUpdaterResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - size: z.number().int().optional(), - canInstall: z.boolean().optional(), - checkedAt: z.number().int().optional(), - downloadURL: z.string().optional(), - status: z.number().int().optional(), - release: z.array(z.lazy(() => Release$.outboundSchema)).optional(), + errors: z.array(z.lazy(() => GetUpdateStatusErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - release: "Release", + rawResponse: "RawResponse", }); - }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUpdateStatusUpdaterResponseBody$ { + /** @deprecated use `GetUpdateStatusUpdaterResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetUpdateStatusUpdaterResponseBody$inboundSchema; + /** @deprecated use `GetUpdateStatusUpdaterResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetUpdateStatusUpdaterResponseBody$outboundSchema; + /** @deprecated use `GetUpdateStatusUpdaterResponseBody$Outbound` instead. */ + export type Outbound = GetUpdateStatusUpdaterResponseBody$Outbound; } /** @internal */ +export const Release$inboundSchema: z.ZodType = z.object({ + key: z.string().optional(), + version: z.string().optional(), + added: z.string().optional(), + fixed: z.string().optional(), + downloadURL: z.string().optional(), + state: z.string().optional(), +}); + +/** @internal */ +export type Release$Outbound = { + key?: string | undefined; + version?: string | undefined; + added?: string | undefined; + fixed?: string | undefined; + downloadURL?: string | undefined; + state?: string | undefined; +}; + +/** @internal */ +export const Release$outboundSchema: z.ZodType = z.object({ + key: z.string().optional(), + version: z.string().optional(), + added: z.string().optional(), + fixed: z.string().optional(), + downloadURL: z.string().optional(), + state: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Release$ { + /** @deprecated use `Release$inboundSchema` instead. */ + export const inboundSchema = Release$inboundSchema; + /** @deprecated use `Release$outboundSchema` instead. */ + export const outboundSchema = Release$outboundSchema; + /** @deprecated use `Release$Outbound` instead. */ + export type Outbound = Release$Outbound; +} + +/** @internal */ +export const GetUpdateStatusMediaContainer$inboundSchema: z.ZodType< + GetUpdateStatusMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + canInstall: z.boolean().optional(), + checkedAt: z.number().int().optional(), + downloadURL: z.string().optional(), + status: z.number().int().optional(), + Release: z.array(z.lazy(() => Release$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Release: "release", + }); + }); + +/** @internal */ +export type GetUpdateStatusMediaContainer$Outbound = { + size?: number | undefined; + canInstall?: boolean | undefined; + checkedAt?: number | undefined; + downloadURL?: string | undefined; + status?: number | undefined; + Release?: Array | undefined; +}; + +/** @internal */ +export const GetUpdateStatusMediaContainer$outboundSchema: z.ZodType< + GetUpdateStatusMediaContainer$Outbound, + z.ZodTypeDef, + GetUpdateStatusMediaContainer +> = z + .object({ + size: z.number().int().optional(), + canInstall: z.boolean().optional(), + checkedAt: z.number().int().optional(), + downloadURL: z.string().optional(), + status: z.number().int().optional(), + release: z.array(z.lazy(() => Release$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + release: "Release", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUpdateStatusMediaContainer$ { + /** @deprecated use `GetUpdateStatusMediaContainer$inboundSchema` instead. */ + export const inboundSchema = GetUpdateStatusMediaContainer$inboundSchema; + /** @deprecated use `GetUpdateStatusMediaContainer$outboundSchema` instead. */ + export const outboundSchema = GetUpdateStatusMediaContainer$outboundSchema; + /** @deprecated use `GetUpdateStatusMediaContainer$Outbound` instead. */ + export type Outbound = GetUpdateStatusMediaContainer$Outbound; +} + +/** @internal */ +export const GetUpdateStatusResponseBody$inboundSchema: z.ZodType< + GetUpdateStatusResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => GetUpdateStatusMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type GetUpdateStatusResponseBody$Outbound = { + MediaContainer?: GetUpdateStatusMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const GetUpdateStatusResponseBody$outboundSchema: z.ZodType< + GetUpdateStatusResponseBody$Outbound, + z.ZodTypeDef, + GetUpdateStatusResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => GetUpdateStatusMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetUpdateStatusResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => GetUpdateStatusMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: GetUpdateStatusMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => GetUpdateStatusMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `GetUpdateStatusResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetUpdateStatusResponseBody$inboundSchema; + /** @deprecated use `GetUpdateStatusResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetUpdateStatusResponseBody$outboundSchema; + /** @deprecated use `GetUpdateStatusResponseBody$Outbound` instead. */ + export type Outbound = GetUpdateStatusResponseBody$Outbound; } /** @internal */ +export const GetUpdateStatusResponse$inboundSchema: z.ZodType< + GetUpdateStatusResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetUpdateStatusResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetUpdateStatusResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetUpdateStatusResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetUpdateStatusResponse$outboundSchema: z.ZodType< + GetUpdateStatusResponse$Outbound, + z.ZodTypeDef, + GetUpdateStatusResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetUpdateStatusResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetUpdateStatusResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetUpdateStatusResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetUpdateStatusResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetUpdateStatusResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetUpdateStatusResponse$inboundSchema` instead. */ + export const inboundSchema = GetUpdateStatusResponse$inboundSchema; + /** @deprecated use `GetUpdateStatusResponse$outboundSchema` instead. */ + export const outboundSchema = GetUpdateStatusResponse$outboundSchema; + /** @deprecated use `GetUpdateStatusResponse$Outbound` instead. */ + export type Outbound = GetUpdateStatusResponse$Outbound; } diff --git a/src/models/getuserdetailsop.ts b/src/models/getuserdetailsop.ts new file mode 100644 index 00000000..fedbd308 --- /dev/null +++ b/src/models/getuserdetailsop.ts @@ -0,0 +1,1137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const GetUserDetailsOpServerList = ["https://plex.tv/api/v2"] as const; + +export type GetUserDetailsErrors = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export type GetUserDetailsResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export class GetUserDetailsResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: GetUserDetailsResponseBodyData; + + constructor(err: GetUserDetailsResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "GetUserDetailsResponseBody"; + } +} + +/** + * Your current mailing list status + */ +export enum MailingListStatus { + Subscribed = "subscribed", + Unsubscribed = "unsubscribed", +} + +export type UserProfile = { + /** + * If the account has automatically select audio and subtitle tracks enabled + */ + autoSelectAudio?: boolean | undefined; + /** + * The preferred audio language for the account + */ + defaultAudioLanguage?: string | undefined; + /** + * The preferred subtitle language for the account + */ + defaultSubtitleLanguage?: string | undefined; + /** + * The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) + */ + autoSelectSubtitle?: number | undefined; + /** + * The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) + */ + defaultSubtitleAccessibility?: number | undefined; + /** + * The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) + */ + defaultSubtitleForced?: number | undefined; + watchedIndicator?: number | undefined; + mediaReviewsVisibility?: number | undefined; +}; + +export enum GetUserDetailsStatus { + Online = "online", + Offline = "offline", +} + +export type Services = { + identifier: string; + endpoint: string; + token: string | null; + secret: string | null; + status: GetUserDetailsStatus; +}; + +export enum Features { + AndroidDolbyVision = "Android - Dolby Vision", + AndroidPiP = "Android - PiP", + CUSunset = "CU Sunset", + HRKEnableEUR = "HRK_enable_EUR", + TREBLEShowFeatures = "TREBLE-show-features", + AdCountdownTimer = "ad-countdown-timer", + AdaptiveBitrate = "adaptive_bitrate", + AmazonLoopDebug = "amazon-loop-debug", + AvodAdAnalysis = "avod-ad-analysis", + AvodNewMedia = "avod-new-media", + BlacklistGetSignin = "blacklist_get_signin", + ClientRadioStations = "client-radio-stations", + CloudflareTurnstileRequired = "cloudflare-turnstile-required", + Collections = "collections", + CommentsAndRepliesPushNotifications = "comments_and_replies_push_notifications", + CommunityAccessPlexTv = "community_access_plex_tv", + CompanionsSonos = "companions_sonos", + CustomHomeRemoval = "custom-home-removal", + DisableHomeUserFriendships = "disable_home_user_friendships", + DisableSharingFriendships = "disable_sharing_friendships", + DrmSupport = "drm_support", + ExcludeRestrictions = "exclude restrictions", + FederatedAuth = "federated-auth", + FriendRequestPushNotifications = "friend_request_push_notifications", + GuidedUpgrade = "guided-upgrade", + Home = "home", + IncreasePasswordComplexity = "increase-password-complexity", + Ios14PrivacyBanner = "ios14-privacy-banner", + IterableNotificationTokens = "iterable-notification-tokens", + KeepPaymentMethod = "keep-payment-method", + KevinBacon = "kevin-bacon", + KoreaConsent = "korea-consent", + LeIsrgRootX1 = "le_isrg_root_x1", + LetsEncrypt = "lets_encrypt", + LightningDvrPivot = "lightning-dvr-pivot", + LiveTvSupportIncompleteSegments = "live-tv-support-incomplete-segments", + Livetv = "livetv", + MetadataSearch = "metadata_search", + NewPlexPassPrices = "new_plex_pass_prices", + NewsProviderSunsetModal = "news-provider-sunset-modal", + PhotosFavorites = "photos-favorites", + PhotosMetadataEdition = "photos-metadata-edition", + PmsHealth = "pms_health", + Radio = "radio", + RateLimitClientToken = "rate-limit-client-token", + ScrobblingServicePlexTv = "scrobbling-service-plex-tv", + SharedServerNotification = "shared_server_notification", + SharedSourceNotification = "shared_source_notification", + SigninWithApple = "signin_with_apple", + SpringServeAdProvider = "spring_serve_ad_provider", + TranscoderCache = "transcoder_cache", + TunerSharing = "tuner-sharing", + TwoFactorAuthentication = "two-factor-authentication", + Unsupportedtuners = "unsupportedtuners", + Upgrade3ds2 = "upgrade-3ds2", + VodSchema = "vod-schema", + VodCloudflare = "vod_cloudflare", + WatchTogetherInvite = "watch-together-invite", + WebServerDashboard = "web_server_dashboard", +} + +/** + * String representation of subscriptionActive + */ +export enum GetUserDetailsPlexStatus { + Inactive = "Inactive", + Active = "Active", +} + +/** + * If the account’s Plex Pass subscription is active + */ +export type Subscription = { + /** + * List of features allowed on your Plex Pass subscription + */ + features?: Array | undefined; + /** + * If the account's Plex Pass subscription is active + */ + active?: boolean | undefined; + /** + * Date the account subscribed to Plex Pass + */ + subscribedAt?: Date | undefined; + /** + * String representation of subscriptionActive + */ + status?: GetUserDetailsPlexStatus | undefined; + /** + * Payment service used for your Plex Pass subscription + */ + paymentService?: string | null | undefined; + /** + * Name of Plex Pass subscription plan + */ + plan?: string | null | undefined; +}; + +export enum GetUserDetailsFeatures { + AndroidDolbyVision = "Android - Dolby Vision", + AndroidPiP = "Android - PiP", + CUSunset = "CU Sunset", + HRKEnableEUR = "HRK_enable_EUR", + TREBLEShowFeatures = "TREBLE-show-features", + AdCountdownTimer = "ad-countdown-timer", + AdaptiveBitrate = "adaptive_bitrate", + AmazonLoopDebug = "amazon-loop-debug", + AvodAdAnalysis = "avod-ad-analysis", + AvodNewMedia = "avod-new-media", + BlacklistGetSignin = "blacklist_get_signin", + ClientRadioStations = "client-radio-stations", + CloudflareTurnstileRequired = "cloudflare-turnstile-required", + Collections = "collections", + CommentsAndRepliesPushNotifications = "comments_and_replies_push_notifications", + CommunityAccessPlexTv = "community_access_plex_tv", + CompanionsSonos = "companions_sonos", + CustomHomeRemoval = "custom-home-removal", + DisableHomeUserFriendships = "disable_home_user_friendships", + DisableSharingFriendships = "disable_sharing_friendships", + DrmSupport = "drm_support", + ExcludeRestrictions = "exclude restrictions", + FederatedAuth = "federated-auth", + FriendRequestPushNotifications = "friend_request_push_notifications", + GuidedUpgrade = "guided-upgrade", + Home = "home", + IncreasePasswordComplexity = "increase-password-complexity", + Ios14PrivacyBanner = "ios14-privacy-banner", + IterableNotificationTokens = "iterable-notification-tokens", + KeepPaymentMethod = "keep-payment-method", + KevinBacon = "kevin-bacon", + KoreaConsent = "korea-consent", + LeIsrgRootX1 = "le_isrg_root_x1", + LetsEncrypt = "lets_encrypt", + LightningDvrPivot = "lightning-dvr-pivot", + LiveTvSupportIncompleteSegments = "live-tv-support-incomplete-segments", + Livetv = "livetv", + MetadataSearch = "metadata_search", + NewPlexPassPrices = "new_plex_pass_prices", + NewsProviderSunsetModal = "news-provider-sunset-modal", + PhotosFavorites = "photos-favorites", + PhotosMetadataEdition = "photos-metadata-edition", + PmsHealth = "pms_health", + Radio = "radio", + RateLimitClientToken = "rate-limit-client-token", + ScrobblingServicePlexTv = "scrobbling-service-plex-tv", + SharedServerNotification = "shared_server_notification", + SharedSourceNotification = "shared_source_notification", + SigninWithApple = "signin_with_apple", + SpringServeAdProvider = "spring_serve_ad_provider", + TranscoderCache = "transcoder_cache", + TunerSharing = "tuner-sharing", + TwoFactorAuthentication = "two-factor-authentication", + Unsupportedtuners = "unsupportedtuners", + Upgrade3ds2 = "upgrade-3ds2", + VodSchema = "vod-schema", + VodCloudflare = "vod_cloudflare", + WatchTogetherInvite = "watch-together-invite", + WebServerDashboard = "web_server_dashboard", +} + +/** + * String representation of subscriptionActive + */ +export enum GetUserDetailsPlexResponseStatus { + Inactive = "Inactive", + Active = "Active", +} + +export type GetUserDetailsSubscription = { + /** + * List of features allowed on your Plex Pass subscription + */ + features?: Array | undefined; + /** + * If the account's Plex Pass subscription is active + */ + active?: boolean | undefined; + /** + * Date the account subscribed to Plex Pass + */ + subscribedAt?: Date | undefined; + /** + * String representation of subscriptionActive + */ + status?: GetUserDetailsPlexResponseStatus | undefined; + /** + * Payment service used for your Plex Pass subscription + */ + paymentService?: string | null | undefined; + /** + * Name of Plex Pass subscription plan + */ + plan?: string | null | undefined; +}; + +/** + * Logged in user details + */ +export type GetUserDetailsUserPlexAccount = { + /** + * Unknown + */ + adsConsent: boolean | null; + /** + * Unknown + */ + adsConsentReminderAt: Date | null; + /** + * Unknown + */ + adsConsentSetAt: Date | null; + /** + * Unknown + */ + anonymous?: boolean | undefined; + /** + * The account token + */ + authToken: string; + /** + * If the two-factor authentication backup codes have been created + */ + backupCodesCreated?: boolean | undefined; + /** + * If the account has been confirmed + */ + confirmed?: boolean | undefined; + /** + * The account country + */ + country: string; + /** + * The account email address + */ + email: string; + /** + * If login with email only is enabled + */ + emailOnlyAuth?: boolean | undefined; + /** + * If experimental features are enabled + */ + experimentalFeatures?: boolean | undefined; + /** + * Your account full name + */ + friendlyName: string; + /** + * List of devices your allowed to use with this account + */ + entitlements: Array; + /** + * If the account is a Plex Home guest user + */ + guest?: boolean | undefined; + /** + * If the account has a password + */ + hasPassword?: boolean | undefined; + /** + * If the account is a Plex Home user + */ + home?: boolean | undefined; + /** + * If the account is the Plex Home admin + */ + homeAdmin?: boolean | undefined; + /** + * The number of accounts in the Plex Home + */ + homeSize: number; + /** + * The Plex account ID + */ + id: number; + /** + * Unix epoch datetime the account joined Plex + */ + joinedAt: number; + /** + * The account locale + */ + locale: string | null; + /** + * If you are subscribed to the Plex newsletter + */ + mailingListActive?: boolean | undefined; + /** + * Your current mailing list status + */ + mailingListStatus: MailingListStatus; + /** + * The maximum number of accounts allowed in the Plex Home + */ + maxHomeSize: number; + /** + * [Might be removed] The hashed Plex Home PIN + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + */ + pin?: string | undefined; + profile: Array; + /** + * If the account has a Plex Home PIN enabled + */ + protected?: boolean | undefined; + /** + * Unix epoch datetime the authtoken expires + */ + rememberExpiresAt: number; + /** + * If the account is a Plex Home managed user + */ + restricted?: boolean | undefined; + /** + * [Might be removed] List of account roles. Plexpass membership listed here + */ + roles?: Array | undefined; + /** + * Unknown + */ + scrobbleTypes: string; + services: Array; + /** + * If the account’s Plex Pass subscription is active + */ + subscription: Subscription; + /** + * Description of the Plex Pass subscription + */ + subscriptionDescription: string | null; + subscriptions: Array; + /** + * URL of the account thumbnail + */ + thumb: string; + /** + * The title of the account (username or friendly name) + */ + title: string; + /** + * If two-factor authentication is enabled + */ + twoFactorEnabled?: boolean | undefined; + /** + * The account username + */ + username: string; + /** + * The account UUID + */ + uuid: string; +}; + +export type GetUserDetailsResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * Logged in user details + */ + userPlexAccount?: GetUserDetailsUserPlexAccount | undefined; +}; + +/** @internal */ +export const GetUserDetailsErrors$inboundSchema: z.ZodType< + GetUserDetailsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetUserDetailsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetUserDetailsErrors$outboundSchema: z.ZodType< + GetUserDetailsErrors$Outbound, + z.ZodTypeDef, + GetUserDetailsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsErrors$ { + /** @deprecated use `GetUserDetailsErrors$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsErrors$inboundSchema; + /** @deprecated use `GetUserDetailsErrors$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsErrors$outboundSchema; + /** @deprecated use `GetUserDetailsErrors$Outbound` instead. */ + export type Outbound = GetUserDetailsErrors$Outbound; +} + +/** @internal */ +export const GetUserDetailsResponseBody$inboundSchema: z.ZodType< + GetUserDetailsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetUserDetailsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetUserDetailsResponseBody(remapped); + }); + +/** @internal */ +export type GetUserDetailsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetUserDetailsResponseBody$outboundSchema: z.ZodType< + GetUserDetailsResponseBody$Outbound, + z.ZodTypeDef, + GetUserDetailsResponseBody +> = z + .instanceof(GetUserDetailsResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetUserDetailsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsResponseBody$ { + /** @deprecated use `GetUserDetailsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsResponseBody$inboundSchema; + /** @deprecated use `GetUserDetailsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsResponseBody$outboundSchema; + /** @deprecated use `GetUserDetailsResponseBody$Outbound` instead. */ + export type Outbound = GetUserDetailsResponseBody$Outbound; +} + +/** @internal */ +export const MailingListStatus$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(MailingListStatus); + +/** @internal */ +export const MailingListStatus$outboundSchema: z.ZodNativeEnum = + MailingListStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MailingListStatus$ { + /** @deprecated use `MailingListStatus$inboundSchema` instead. */ + export const inboundSchema = MailingListStatus$inboundSchema; + /** @deprecated use `MailingListStatus$outboundSchema` instead. */ + export const outboundSchema = MailingListStatus$outboundSchema; +} + +/** @internal */ +export const UserProfile$inboundSchema: z.ZodType = z.object({ + autoSelectAudio: z.boolean().default(true), + defaultAudioLanguage: z.string().optional(), + defaultSubtitleLanguage: z.string().optional(), + autoSelectSubtitle: z.number().int().optional(), + defaultSubtitleAccessibility: z.number().int().optional(), + defaultSubtitleForced: z.number().int().optional(), + watchedIndicator: z.number().int().optional(), + mediaReviewsVisibility: z.number().int().optional(), +}); + +/** @internal */ +export type UserProfile$Outbound = { + autoSelectAudio: boolean; + defaultAudioLanguage?: string | undefined; + defaultSubtitleLanguage?: string | undefined; + autoSelectSubtitle?: number | undefined; + defaultSubtitleAccessibility?: number | undefined; + defaultSubtitleForced?: number | undefined; + watchedIndicator?: number | undefined; + mediaReviewsVisibility?: number | undefined; +}; + +/** @internal */ +export const UserProfile$outboundSchema: z.ZodType< + UserProfile$Outbound, + z.ZodTypeDef, + UserProfile +> = z.object({ + autoSelectAudio: z.boolean().default(true), + defaultAudioLanguage: z.string().optional(), + defaultSubtitleLanguage: z.string().optional(), + autoSelectSubtitle: z.number().int().optional(), + defaultSubtitleAccessibility: z.number().int().optional(), + defaultSubtitleForced: z.number().int().optional(), + watchedIndicator: z.number().int().optional(), + mediaReviewsVisibility: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UserProfile$ { + /** @deprecated use `UserProfile$inboundSchema` instead. */ + export const inboundSchema = UserProfile$inboundSchema; + /** @deprecated use `UserProfile$outboundSchema` instead. */ + export const outboundSchema = UserProfile$outboundSchema; + /** @deprecated use `UserProfile$Outbound` instead. */ + export type Outbound = UserProfile$Outbound; +} + +/** @internal */ +export const GetUserDetailsStatus$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(GetUserDetailsStatus); + +/** @internal */ +export const GetUserDetailsStatus$outboundSchema: z.ZodNativeEnum = + GetUserDetailsStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsStatus$ { + /** @deprecated use `GetUserDetailsStatus$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsStatus$inboundSchema; + /** @deprecated use `GetUserDetailsStatus$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsStatus$outboundSchema; +} + +/** @internal */ +export const Services$inboundSchema: z.ZodType = z.object({ + identifier: z.string(), + endpoint: z.string(), + token: z.nullable(z.string()), + secret: z.nullable(z.string()), + status: GetUserDetailsStatus$inboundSchema, +}); + +/** @internal */ +export type Services$Outbound = { + identifier: string; + endpoint: string; + token: string | null; + secret: string | null; + status: string; +}; + +/** @internal */ +export const Services$outboundSchema: z.ZodType = + z.object({ + identifier: z.string(), + endpoint: z.string(), + token: z.nullable(z.string()), + secret: z.nullable(z.string()), + status: GetUserDetailsStatus$outboundSchema, + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Services$ { + /** @deprecated use `Services$inboundSchema` instead. */ + export const inboundSchema = Services$inboundSchema; + /** @deprecated use `Services$outboundSchema` instead. */ + export const outboundSchema = Services$outboundSchema; + /** @deprecated use `Services$Outbound` instead. */ + export type Outbound = Services$Outbound; +} + +/** @internal */ +export const Features$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Features); + +/** @internal */ +export const Features$outboundSchema: z.ZodNativeEnum = Features$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Features$ { + /** @deprecated use `Features$inboundSchema` instead. */ + export const inboundSchema = Features$inboundSchema; + /** @deprecated use `Features$outboundSchema` instead. */ + export const outboundSchema = Features$outboundSchema; +} + +/** @internal */ +export const GetUserDetailsPlexStatus$inboundSchema: z.ZodNativeEnum< + typeof GetUserDetailsPlexStatus +> = z.nativeEnum(GetUserDetailsPlexStatus); + +/** @internal */ +export const GetUserDetailsPlexStatus$outboundSchema: z.ZodNativeEnum< + typeof GetUserDetailsPlexStatus +> = GetUserDetailsPlexStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsPlexStatus$ { + /** @deprecated use `GetUserDetailsPlexStatus$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsPlexStatus$inboundSchema; + /** @deprecated use `GetUserDetailsPlexStatus$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsPlexStatus$outboundSchema; +} + +/** @internal */ +export const Subscription$inboundSchema: z.ZodType = z.object({ + features: z.array(Features$inboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + .optional(), + status: GetUserDetailsPlexStatus$inboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** @internal */ +export type Subscription$Outbound = { + features?: Array | undefined; + active?: boolean | undefined; + subscribedAt?: string | undefined; + status?: string | undefined; + paymentService?: string | null | undefined; + plan?: string | null | undefined; +}; + +/** @internal */ +export const Subscription$outboundSchema: z.ZodType< + Subscription$Outbound, + z.ZodTypeDef, + Subscription +> = z.object({ + features: z.array(Features$outboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + status: GetUserDetailsPlexStatus$outboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Subscription$ { + /** @deprecated use `Subscription$inboundSchema` instead. */ + export const inboundSchema = Subscription$inboundSchema; + /** @deprecated use `Subscription$outboundSchema` instead. */ + export const outboundSchema = Subscription$outboundSchema; + /** @deprecated use `Subscription$Outbound` instead. */ + export type Outbound = Subscription$Outbound; +} + +/** @internal */ +export const GetUserDetailsFeatures$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(GetUserDetailsFeatures); + +/** @internal */ +export const GetUserDetailsFeatures$outboundSchema: z.ZodNativeEnum = + GetUserDetailsFeatures$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsFeatures$ { + /** @deprecated use `GetUserDetailsFeatures$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsFeatures$inboundSchema; + /** @deprecated use `GetUserDetailsFeatures$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsFeatures$outboundSchema; +} + +/** @internal */ +export const GetUserDetailsPlexResponseStatus$inboundSchema: z.ZodNativeEnum< + typeof GetUserDetailsPlexResponseStatus +> = z.nativeEnum(GetUserDetailsPlexResponseStatus); + +/** @internal */ +export const GetUserDetailsPlexResponseStatus$outboundSchema: z.ZodNativeEnum< + typeof GetUserDetailsPlexResponseStatus +> = GetUserDetailsPlexResponseStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsPlexResponseStatus$ { + /** @deprecated use `GetUserDetailsPlexResponseStatus$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsPlexResponseStatus$inboundSchema; + /** @deprecated use `GetUserDetailsPlexResponseStatus$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsPlexResponseStatus$outboundSchema; +} + +/** @internal */ +export const GetUserDetailsSubscription$inboundSchema: z.ZodType< + GetUserDetailsSubscription, + z.ZodTypeDef, + unknown +> = z.object({ + features: z.array(GetUserDetailsFeatures$inboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + .optional(), + status: GetUserDetailsPlexResponseStatus$inboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** @internal */ +export type GetUserDetailsSubscription$Outbound = { + features?: Array | undefined; + active?: boolean | undefined; + subscribedAt?: string | undefined; + status?: string | undefined; + paymentService?: string | null | undefined; + plan?: string | null | undefined; +}; + +/** @internal */ +export const GetUserDetailsSubscription$outboundSchema: z.ZodType< + GetUserDetailsSubscription$Outbound, + z.ZodTypeDef, + GetUserDetailsSubscription +> = z.object({ + features: z.array(GetUserDetailsFeatures$outboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + status: GetUserDetailsPlexResponseStatus$outboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsSubscription$ { + /** @deprecated use `GetUserDetailsSubscription$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsSubscription$inboundSchema; + /** @deprecated use `GetUserDetailsSubscription$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsSubscription$outboundSchema; + /** @deprecated use `GetUserDetailsSubscription$Outbound` instead. */ + export type Outbound = GetUserDetailsSubscription$Outbound; +} + +/** @internal */ +export const GetUserDetailsUserPlexAccount$inboundSchema: z.ZodType< + GetUserDetailsUserPlexAccount, + z.ZodTypeDef, + unknown +> = z.object({ + adsConsent: z.nullable(z.boolean()), + adsConsentReminderAt: z.nullable( + z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + ), + adsConsentSetAt: z.nullable( + z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + ), + anonymous: z.boolean(), + authToken: z.string(), + backupCodesCreated: z.boolean(), + confirmed: z.boolean(), + country: z.string(), + email: z.string(), + emailOnlyAuth: z.boolean(), + experimentalFeatures: z.boolean(), + friendlyName: z.string(), + entitlements: z.array(z.string()), + guest: z.boolean(), + hasPassword: z.boolean().default(true), + home: z.boolean(), + homeAdmin: z.boolean(), + homeSize: z.number().int(), + id: z.number().int(), + joinedAt: z.number().int(), + locale: z.nullable(z.string()), + mailingListActive: z.boolean(), + mailingListStatus: MailingListStatus$inboundSchema, + maxHomeSize: z.number().int(), + pin: z.string().optional(), + profile: z.array(z.lazy(() => UserProfile$inboundSchema)), + protected: z.boolean(), + rememberExpiresAt: z.number().int(), + restricted: z.boolean(), + roles: z.array(z.string()).optional(), + scrobbleTypes: z.string(), + services: z.array(z.lazy(() => Services$inboundSchema)), + subscription: z.lazy(() => Subscription$inboundSchema), + subscriptionDescription: z.nullable(z.string()), + subscriptions: z.array(z.lazy(() => GetUserDetailsSubscription$inboundSchema)), + thumb: z.string(), + title: z.string(), + twoFactorEnabled: z.boolean(), + username: z.string(), + uuid: z.string(), +}); + +/** @internal */ +export type GetUserDetailsUserPlexAccount$Outbound = { + adsConsent: boolean | null; + adsConsentReminderAt: string | null; + adsConsentSetAt: string | null; + anonymous: boolean; + authToken: string; + backupCodesCreated: boolean; + confirmed: boolean; + country: string; + email: string; + emailOnlyAuth: boolean; + experimentalFeatures: boolean; + friendlyName: string; + entitlements: Array; + guest: boolean; + hasPassword: boolean; + home: boolean; + homeAdmin: boolean; + homeSize: number; + id: number; + joinedAt: number; + locale: string | null; + mailingListActive: boolean; + mailingListStatus: string; + maxHomeSize: number; + pin?: string | undefined; + profile: Array; + protected: boolean; + rememberExpiresAt: number; + restricted: boolean; + roles?: Array | undefined; + scrobbleTypes: string; + services: Array; + subscription: Subscription$Outbound; + subscriptionDescription: string | null; + subscriptions: Array; + thumb: string; + title: string; + twoFactorEnabled: boolean; + username: string; + uuid: string; +}; + +/** @internal */ +export const GetUserDetailsUserPlexAccount$outboundSchema: z.ZodType< + GetUserDetailsUserPlexAccount$Outbound, + z.ZodTypeDef, + GetUserDetailsUserPlexAccount +> = z.object({ + adsConsent: z.nullable(z.boolean()), + adsConsentReminderAt: z.nullable(z.date().transform((v) => v.toISOString())), + adsConsentSetAt: z.nullable(z.date().transform((v) => v.toISOString())), + anonymous: z.boolean().default(false), + authToken: z.string(), + backupCodesCreated: z.boolean().default(false), + confirmed: z.boolean().default(false), + country: z.string(), + email: z.string(), + emailOnlyAuth: z.boolean().default(false), + experimentalFeatures: z.boolean().default(false), + friendlyName: z.string(), + entitlements: z.array(z.string()), + guest: z.boolean().default(false), + hasPassword: z.boolean().default(true), + home: z.boolean().default(false), + homeAdmin: z.boolean().default(false), + homeSize: z.number().int(), + id: z.number().int(), + joinedAt: z.number().int(), + locale: z.nullable(z.string()), + mailingListActive: z.boolean().default(false), + mailingListStatus: MailingListStatus$outboundSchema, + maxHomeSize: z.number().int(), + pin: z.string().optional(), + profile: z.array(z.lazy(() => UserProfile$outboundSchema)), + protected: z.boolean().default(false), + rememberExpiresAt: z.number().int(), + restricted: z.boolean().default(false), + roles: z.array(z.string()).optional(), + scrobbleTypes: z.string(), + services: z.array(z.lazy(() => Services$outboundSchema)), + subscription: z.lazy(() => Subscription$outboundSchema), + subscriptionDescription: z.nullable(z.string()), + subscriptions: z.array(z.lazy(() => GetUserDetailsSubscription$outboundSchema)), + thumb: z.string(), + title: z.string(), + twoFactorEnabled: z.boolean().default(false), + username: z.string(), + uuid: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsUserPlexAccount$ { + /** @deprecated use `GetUserDetailsUserPlexAccount$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsUserPlexAccount$inboundSchema; + /** @deprecated use `GetUserDetailsUserPlexAccount$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsUserPlexAccount$outboundSchema; + /** @deprecated use `GetUserDetailsUserPlexAccount$Outbound` instead. */ + export type Outbound = GetUserDetailsUserPlexAccount$Outbound; +} + +/** @internal */ +export const GetUserDetailsResponse$inboundSchema: z.ZodType< + GetUserDetailsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + UserPlexAccount: z.lazy(() => GetUserDetailsUserPlexAccount$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + UserPlexAccount: "userPlexAccount", + }); + }); + +/** @internal */ +export type GetUserDetailsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + UserPlexAccount?: GetUserDetailsUserPlexAccount$Outbound | undefined; +}; + +/** @internal */ +export const GetUserDetailsResponse$outboundSchema: z.ZodType< + GetUserDetailsResponse$Outbound, + z.ZodTypeDef, + GetUserDetailsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + userPlexAccount: z.lazy(() => GetUserDetailsUserPlexAccount$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + userPlexAccount: "UserPlexAccount", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserDetailsResponse$ { + /** @deprecated use `GetUserDetailsResponse$inboundSchema` instead. */ + export const inboundSchema = GetUserDetailsResponse$inboundSchema; + /** @deprecated use `GetUserDetailsResponse$outboundSchema` instead. */ + export const outboundSchema = GetUserDetailsResponse$outboundSchema; + /** @deprecated use `GetUserDetailsResponse$Outbound` instead. */ + export type Outbound = GetUserDetailsResponse$Outbound; +} diff --git a/src/models/getuserfriendsop.ts b/src/models/getuserfriendsop.ts new file mode 100644 index 00000000..b08337e1 --- /dev/null +++ b/src/models/getuserfriendsop.ts @@ -0,0 +1,434 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const GetUserFriendsOpServerList = ["https://plex.tv/api/v2"] as const; + +export type GetUserFriendsErrors = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export type GetUserFriendsResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export class GetUserFriendsResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: GetUserFriendsResponseBodyData; + + constructor(err: GetUserFriendsResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "GetUserFriendsResponseBody"; + } +} + +export type SharedServers = {}; + +export type SharedSources = {}; + +/** + * Current friend request status + */ +export enum Status { + Accepted = "accepted", +} + +export type Friend = { + /** + * The account email address + */ + email: string; + /** + * The account full name + */ + friendlyName: string | null; + /** + * If the account is a Plex Home user + */ + home: boolean; + /** + * The Plex account ID + */ + id: number; + /** + * If the account is a Plex Home managed user + */ + restricted?: boolean | undefined; + sharedServers: Array; + sharedSources: Array; + /** + * Current friend request status + */ + status: Status; + /** + * URL of the account thumbnail + */ + thumb: string; + /** + * The title of the account (username or friendly name) + */ + title: string; + /** + * The account username + */ + username: string; + /** + * The account Universally Unique Identifier (UUID) + */ + uuid: string; +}; + +export type GetUserFriendsResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * Friends Data + */ + friends?: Array | undefined; +}; + +/** @internal */ +export const GetUserFriendsErrors$inboundSchema: z.ZodType< + GetUserFriendsErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetUserFriendsErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetUserFriendsErrors$outboundSchema: z.ZodType< + GetUserFriendsErrors$Outbound, + z.ZodTypeDef, + GetUserFriendsErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserFriendsErrors$ { + /** @deprecated use `GetUserFriendsErrors$inboundSchema` instead. */ + export const inboundSchema = GetUserFriendsErrors$inboundSchema; + /** @deprecated use `GetUserFriendsErrors$outboundSchema` instead. */ + export const outboundSchema = GetUserFriendsErrors$outboundSchema; + /** @deprecated use `GetUserFriendsErrors$Outbound` instead. */ + export type Outbound = GetUserFriendsErrors$Outbound; +} + +/** @internal */ +export const GetUserFriendsResponseBody$inboundSchema: z.ZodType< + GetUserFriendsResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetUserFriendsErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetUserFriendsResponseBody(remapped); + }); + +/** @internal */ +export type GetUserFriendsResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetUserFriendsResponseBody$outboundSchema: z.ZodType< + GetUserFriendsResponseBody$Outbound, + z.ZodTypeDef, + GetUserFriendsResponseBody +> = z + .instanceof(GetUserFriendsResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetUserFriendsErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserFriendsResponseBody$ { + /** @deprecated use `GetUserFriendsResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetUserFriendsResponseBody$inboundSchema; + /** @deprecated use `GetUserFriendsResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetUserFriendsResponseBody$outboundSchema; + /** @deprecated use `GetUserFriendsResponseBody$Outbound` instead. */ + export type Outbound = GetUserFriendsResponseBody$Outbound; +} + +/** @internal */ +export const SharedServers$inboundSchema: z.ZodType = + z.object({}); + +/** @internal */ +export type SharedServers$Outbound = {}; + +/** @internal */ +export const SharedServers$outboundSchema: z.ZodType< + SharedServers$Outbound, + z.ZodTypeDef, + SharedServers +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SharedServers$ { + /** @deprecated use `SharedServers$inboundSchema` instead. */ + export const inboundSchema = SharedServers$inboundSchema; + /** @deprecated use `SharedServers$outboundSchema` instead. */ + export const outboundSchema = SharedServers$outboundSchema; + /** @deprecated use `SharedServers$Outbound` instead. */ + export type Outbound = SharedServers$Outbound; +} + +/** @internal */ +export const SharedSources$inboundSchema: z.ZodType = + z.object({}); + +/** @internal */ +export type SharedSources$Outbound = {}; + +/** @internal */ +export const SharedSources$outboundSchema: z.ZodType< + SharedSources$Outbound, + z.ZodTypeDef, + SharedSources +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SharedSources$ { + /** @deprecated use `SharedSources$inboundSchema` instead. */ + export const inboundSchema = SharedSources$inboundSchema; + /** @deprecated use `SharedSources$outboundSchema` instead. */ + export const outboundSchema = SharedSources$outboundSchema; + /** @deprecated use `SharedSources$Outbound` instead. */ + export type Outbound = SharedSources$Outbound; +} + +/** @internal */ +export const Status$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Status); + +/** @internal */ +export const Status$outboundSchema: z.ZodNativeEnum = Status$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Status$ { + /** @deprecated use `Status$inboundSchema` instead. */ + export const inboundSchema = Status$inboundSchema; + /** @deprecated use `Status$outboundSchema` instead. */ + export const outboundSchema = Status$outboundSchema; +} + +/** @internal */ +export const Friend$inboundSchema: z.ZodType = z.object({ + email: z.string(), + friendlyName: z.nullable(z.string()), + home: z.boolean(), + id: z.number().int(), + restricted: z.boolean(), + sharedServers: z.array(z.lazy(() => SharedServers$inboundSchema)), + sharedSources: z.array(z.lazy(() => SharedSources$inboundSchema)), + status: Status$inboundSchema, + thumb: z.string(), + title: z.string(), + username: z.string(), + uuid: z.string(), +}); + +/** @internal */ +export type Friend$Outbound = { + email: string; + friendlyName: string | null; + home: boolean; + id: number; + restricted: boolean; + sharedServers: Array; + sharedSources: Array; + status: string; + thumb: string; + title: string; + username: string; + uuid: string; +}; + +/** @internal */ +export const Friend$outboundSchema: z.ZodType = z.object({ + email: z.string(), + friendlyName: z.nullable(z.string()), + home: z.boolean(), + id: z.number().int(), + restricted: z.boolean().default(false), + sharedServers: z.array(z.lazy(() => SharedServers$outboundSchema)), + sharedSources: z.array(z.lazy(() => SharedSources$outboundSchema)), + status: Status$outboundSchema, + thumb: z.string(), + title: z.string(), + username: z.string(), + uuid: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Friend$ { + /** @deprecated use `Friend$inboundSchema` instead. */ + export const inboundSchema = Friend$inboundSchema; + /** @deprecated use `Friend$outboundSchema` instead. */ + export const outboundSchema = Friend$outboundSchema; + /** @deprecated use `Friend$Outbound` instead. */ + export type Outbound = Friend$Outbound; +} + +/** @internal */ +export const GetUserFriendsResponse$inboundSchema: z.ZodType< + GetUserFriendsResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + Friends: z.array(z.lazy(() => Friend$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + Friends: "friends", + }); + }); + +/** @internal */ +export type GetUserFriendsResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + Friends?: Array | undefined; +}; + +/** @internal */ +export const GetUserFriendsResponse$outboundSchema: z.ZodType< + GetUserFriendsResponse$Outbound, + z.ZodTypeDef, + GetUserFriendsResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + friends: z.array(z.lazy(() => Friend$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + friends: "Friends", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetUserFriendsResponse$ { + /** @deprecated use `GetUserFriendsResponse$inboundSchema` instead. */ + export const inboundSchema = GetUserFriendsResponse$inboundSchema; + /** @deprecated use `GetUserFriendsResponse$outboundSchema` instead. */ + export const outboundSchema = GetUserFriendsResponse$outboundSchema; + /** @deprecated use `GetUserFriendsResponse$Outbound` instead. */ + export type Outbound = GetUserFriendsResponse$Outbound; +} diff --git a/src/models/getwatchlistop.ts b/src/models/getwatchlistop.ts index 2586efca..b4f64c92 100644 --- a/src/models/getwatchlistop.ts +++ b/src/models/getwatchlistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -151,7 +151,11 @@ export class GetWatchlistWatchlistResponseBody extends Error { data$: GetWatchlistWatchlistResponseBodyData; constructor(err: GetWatchlistWatchlistResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -161,11 +165,6 @@ export class GetWatchlistWatchlistResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "GetWatchlistWatchlistResponseBody"; } } @@ -247,397 +246,567 @@ export type GetWatchlistResponse = { }; /** @internal */ +export const PathParamFilter$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(PathParamFilter); + +/** @internal */ +export const PathParamFilter$outboundSchema: z.ZodNativeEnum = + PathParamFilter$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PathParamFilter$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(PathParamFilter); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `PathParamFilter$inboundSchema` instead. */ + export const inboundSchema = PathParamFilter$inboundSchema; + /** @deprecated use `PathParamFilter$outboundSchema` instead. */ + export const outboundSchema = PathParamFilter$outboundSchema; } /** @internal */ +export const Libtype$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Libtype); + +/** @internal */ +export const Libtype$outboundSchema: z.ZodNativeEnum = Libtype$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Libtype$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Libtype); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Libtype$inboundSchema` instead. */ + export const inboundSchema = Libtype$inboundSchema; + /** @deprecated use `Libtype$outboundSchema` instead. */ + export const outboundSchema = Libtype$outboundSchema; } /** @internal */ +export const IncludeCollections$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(IncludeCollections); + +/** @internal */ +export const IncludeCollections$outboundSchema: z.ZodNativeEnum = + IncludeCollections$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace IncludeCollections$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(IncludeCollections); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `IncludeCollections$inboundSchema` instead. */ + export const inboundSchema = IncludeCollections$inboundSchema; + /** @deprecated use `IncludeCollections$outboundSchema` instead. */ + export const outboundSchema = IncludeCollections$outboundSchema; } /** @internal */ +export const IncludeExternalMedia$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(IncludeExternalMedia); + +/** @internal */ +export const IncludeExternalMedia$outboundSchema: z.ZodNativeEnum = + IncludeExternalMedia$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace IncludeExternalMedia$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(IncludeExternalMedia); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `IncludeExternalMedia$inboundSchema` instead. */ + export const inboundSchema = IncludeExternalMedia$inboundSchema; + /** @deprecated use `IncludeExternalMedia$outboundSchema` instead. */ + export const outboundSchema = IncludeExternalMedia$outboundSchema; } /** @internal */ +export const GetWatchlistRequest$inboundSchema: z.ZodType< + GetWatchlistRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + filter: PathParamFilter$inboundSchema, + sort: z.string().optional(), + libtype: Libtype$inboundSchema.optional(), + maxresults: z.number().int().optional(), + includeCollections: IncludeCollections$inboundSchema.optional(), + includeExternalMedia: IncludeExternalMedia$inboundSchema.optional(), + "X-Plex-Token": z.string(), + "X-Plex-Container-Start": z.number().int().optional(), + "X-Plex-Container-Size": z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Token": "xPlexToken", + "X-Plex-Container-Start": "xPlexContainerStart", + "X-Plex-Container-Size": "xPlexContainerSize", + }); + }); + +/** @internal */ +export type GetWatchlistRequest$Outbound = { + filter: string; + sort?: string | undefined; + libtype?: string | undefined; + maxresults?: number | undefined; + includeCollections?: number | undefined; + includeExternalMedia?: number | undefined; + "X-Plex-Token": string; + "X-Plex-Container-Start"?: number | undefined; + "X-Plex-Container-Size"?: number | undefined; +}; + +/** @internal */ +export const GetWatchlistRequest$outboundSchema: z.ZodType< + GetWatchlistRequest$Outbound, + z.ZodTypeDef, + GetWatchlistRequest +> = z + .object({ + filter: PathParamFilter$outboundSchema, + sort: z.string().optional(), + libtype: Libtype$outboundSchema.optional(), + maxresults: z.number().int().optional(), + includeCollections: IncludeCollections$outboundSchema.optional(), + includeExternalMedia: IncludeExternalMedia$outboundSchema.optional(), + xPlexToken: z.string(), + xPlexContainerStart: z.number().int().optional(), + xPlexContainerSize: z.number().int().optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexToken: "X-Plex-Token", + xPlexContainerStart: "X-Plex-Container-Start", + xPlexContainerSize: "X-Plex-Container-Size", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetWatchlistRequest$ { - export const inboundSchema: z.ZodType = z - .object({ - filter: PathParamFilter$.inboundSchema, - sort: z.string().optional(), - libtype: Libtype$.inboundSchema.optional(), - maxresults: z.number().int().optional(), - includeCollections: IncludeCollections$.inboundSchema.optional(), - includeExternalMedia: IncludeExternalMedia$.inboundSchema.optional(), - "X-Plex-Token": z.string(), - "X-Plex-Container-Start": z.number().int().optional(), - "X-Plex-Container-Size": z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - "X-Plex-Token": "xPlexToken", - "X-Plex-Container-Start": "xPlexContainerStart", - "X-Plex-Container-Size": "xPlexContainerSize", - }); - }); - - export type Outbound = { - filter: string; - sort?: string | undefined; - libtype?: string | undefined; - maxresults?: number | undefined; - includeCollections?: number | undefined; - includeExternalMedia?: number | undefined; - "X-Plex-Token": string; - "X-Plex-Container-Start"?: number | undefined; - "X-Plex-Container-Size"?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - filter: PathParamFilter$.outboundSchema, - sort: z.string().optional(), - libtype: Libtype$.outboundSchema.optional(), - maxresults: z.number().int().optional(), - includeCollections: IncludeCollections$.outboundSchema.optional(), - includeExternalMedia: IncludeExternalMedia$.outboundSchema.optional(), - xPlexToken: z.string(), - xPlexContainerStart: z.number().int().optional(), - xPlexContainerSize: z.number().int().optional(), - }) - .transform((v) => { - return remap$(v, { - xPlexToken: "X-Plex-Token", - xPlexContainerStart: "X-Plex-Container-Start", - xPlexContainerSize: "X-Plex-Container-Size", - }); - }); + /** @deprecated use `GetWatchlistRequest$inboundSchema` instead. */ + export const inboundSchema = GetWatchlistRequest$inboundSchema; + /** @deprecated use `GetWatchlistRequest$outboundSchema` instead. */ + export const outboundSchema = GetWatchlistRequest$outboundSchema; + /** @deprecated use `GetWatchlistRequest$Outbound` instead. */ + export type Outbound = GetWatchlistRequest$Outbound; } /** @internal */ +export const GetWatchlistErrors$inboundSchema: z.ZodType< + GetWatchlistErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type GetWatchlistErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const GetWatchlistErrors$outboundSchema: z.ZodType< + GetWatchlistErrors$Outbound, + z.ZodTypeDef, + GetWatchlistErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetWatchlistErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `GetWatchlistErrors$inboundSchema` instead. */ + export const inboundSchema = GetWatchlistErrors$inboundSchema; + /** @deprecated use `GetWatchlistErrors$outboundSchema` instead. */ + export const outboundSchema = GetWatchlistErrors$outboundSchema; + /** @deprecated use `GetWatchlistErrors$Outbound` instead. */ + export type Outbound = GetWatchlistErrors$Outbound; } /** @internal */ +export const GetWatchlistWatchlistResponseBody$inboundSchema: z.ZodType< + GetWatchlistWatchlistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => GetWatchlistErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new GetWatchlistWatchlistResponseBody(remapped); + }); + +/** @internal */ +export type GetWatchlistWatchlistResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const GetWatchlistWatchlistResponseBody$outboundSchema: z.ZodType< + GetWatchlistWatchlistResponseBody$Outbound, + z.ZodTypeDef, + GetWatchlistWatchlistResponseBody +> = z + .instanceof(GetWatchlistWatchlistResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => GetWatchlistErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetWatchlistWatchlistResponseBody$ { - export const inboundSchema: z.ZodType< - GetWatchlistWatchlistResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => GetWatchlistErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new GetWatchlistWatchlistResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - GetWatchlistWatchlistResponseBody - > = z - .instanceof(GetWatchlistWatchlistResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => GetWatchlistErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `GetWatchlistWatchlistResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetWatchlistWatchlistResponseBody$inboundSchema; + /** @deprecated use `GetWatchlistWatchlistResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetWatchlistWatchlistResponseBody$outboundSchema; + /** @deprecated use `GetWatchlistWatchlistResponseBody$Outbound` instead. */ + export type Outbound = GetWatchlistWatchlistResponseBody$Outbound; } /** @internal */ +export const Image$inboundSchema: z.ZodType = z.object({ + alt: z.string().optional(), + type: z.string().optional(), + url: z.string().optional(), +}); + +/** @internal */ +export type Image$Outbound = { + alt?: string | undefined; + type?: string | undefined; + url?: string | undefined; +}; + +/** @internal */ +export const Image$outboundSchema: z.ZodType = z.object({ + alt: z.string().optional(), + type: z.string().optional(), + url: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Image$ { - export const inboundSchema: z.ZodType = z.object({ - alt: z.string().optional(), - type: z.string().optional(), - url: z.string().optional(), - }); - - export type Outbound = { - alt?: string | undefined; - type?: string | undefined; - url?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - alt: z.string().optional(), - type: z.string().optional(), - url: z.string().optional(), - }); + /** @deprecated use `Image$inboundSchema` instead. */ + export const inboundSchema = Image$inboundSchema; + /** @deprecated use `Image$outboundSchema` instead. */ + export const outboundSchema = Image$outboundSchema; + /** @deprecated use `Image$Outbound` instead. */ + export type Outbound = Image$Outbound; } /** @internal */ +export const Metadata$inboundSchema: z.ZodType = z + .object({ + art: z.string().optional(), + guid: z.string().optional(), + key: z.string().optional(), + ratingKey: z.string().optional(), + studio: z.string().optional(), + tagline: z.string().optional(), + type: z.string().optional(), + thumb: z.string().optional(), + addedAt: z.number().int().optional(), + duration: z.number().int().optional(), + publicPagesURL: z.string().optional(), + slug: z.string().optional(), + userState: z.boolean().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + originallyAvailableAt: z + .string() + .transform((v) => new RFCDate(v)) + .optional(), + year: z.number().int().optional(), + Image: z.array(z.lazy(() => Image$inboundSchema)).optional(), + banner: z.string().optional(), + rating: z.number().optional(), + expiresAt: z.number().int().optional(), + originalTitle: z.string().optional(), + audienceRating: z.number().optional(), + audienceRatingImage: z.string().optional(), + ratingImage: z.string().optional(), + imdbRatingCount: z.number().int().optional(), + subtype: z.string().optional(), + theme: z.string().optional(), + leafCount: z.number().int().optional(), + childCount: z.number().int().optional(), + isContinuingSeries: z.boolean().optional(), + skipChildren: z.boolean().optional(), + availabilityId: z.string().optional(), + streamingMediaId: z.string().optional(), + playableKey: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + Image: "image", + }); + }); + +/** @internal */ +export type Metadata$Outbound = { + art?: string | undefined; + guid?: string | undefined; + key?: string | undefined; + ratingKey?: string | undefined; + studio?: string | undefined; + tagline?: string | undefined; + type?: string | undefined; + thumb?: string | undefined; + addedAt?: number | undefined; + duration?: number | undefined; + publicPagesURL?: string | undefined; + slug?: string | undefined; + userState?: boolean | undefined; + title?: string | undefined; + contentRating?: string | undefined; + originallyAvailableAt?: string | undefined; + year?: number | undefined; + Image?: Array | undefined; + banner?: string | undefined; + rating?: number | undefined; + expiresAt?: number | undefined; + originalTitle?: string | undefined; + audienceRating?: number | undefined; + audienceRatingImage?: string | undefined; + ratingImage?: string | undefined; + imdbRatingCount?: number | undefined; + subtype?: string | undefined; + theme?: string | undefined; + leafCount?: number | undefined; + childCount?: number | undefined; + isContinuingSeries?: boolean | undefined; + skipChildren?: boolean | undefined; + availabilityId?: string | undefined; + streamingMediaId?: string | undefined; + playableKey?: string | undefined; +}; + +/** @internal */ +export const Metadata$outboundSchema: z.ZodType = z + .object({ + art: z.string().optional(), + guid: z.string().optional(), + key: z.string().optional(), + ratingKey: z.string().optional(), + studio: z.string().optional(), + tagline: z.string().optional(), + type: z.string().optional(), + thumb: z.string().optional(), + addedAt: z.number().int().optional(), + duration: z.number().int().optional(), + publicPagesURL: z.string().optional(), + slug: z.string().optional(), + userState: z.boolean().optional(), + title: z.string().optional(), + contentRating: z.string().optional(), + originallyAvailableAt: z + .instanceof(RFCDate) + .transform((v) => v.toString()) + .optional(), + year: z.number().int().optional(), + image: z.array(z.lazy(() => Image$outboundSchema)).optional(), + banner: z.string().optional(), + rating: z.number().optional(), + expiresAt: z.number().int().optional(), + originalTitle: z.string().optional(), + audienceRating: z.number().optional(), + audienceRatingImage: z.string().optional(), + ratingImage: z.string().optional(), + imdbRatingCount: z.number().int().optional(), + subtype: z.string().optional(), + theme: z.string().optional(), + leafCount: z.number().int().optional(), + childCount: z.number().int().optional(), + isContinuingSeries: z.boolean().optional(), + skipChildren: z.boolean().optional(), + availabilityId: z.string().optional(), + streamingMediaId: z.string().optional(), + playableKey: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + image: "Image", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Metadata$ { - export const inboundSchema: z.ZodType = z - .object({ - art: z.string().optional(), - guid: z.string().optional(), - key: z.string().optional(), - ratingKey: z.string().optional(), - studio: z.string().optional(), - tagline: z.string().optional(), - type: z.string().optional(), - thumb: z.string().optional(), - addedAt: z.number().int().optional(), - duration: z.number().int().optional(), - publicPagesURL: z.string().optional(), - slug: z.string().optional(), - userState: z.boolean().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - originallyAvailableAt: z - .string() - .transform((v) => new RFCDate(v)) - .optional(), - year: z.number().int().optional(), - Image: z.array(z.lazy(() => Image$.inboundSchema)).optional(), - banner: z.string().optional(), - rating: z.number().optional(), - expiresAt: z.number().int().optional(), - originalTitle: z.string().optional(), - audienceRating: z.number().optional(), - audienceRatingImage: z.string().optional(), - ratingImage: z.string().optional(), - imdbRatingCount: z.number().int().optional(), - subtype: z.string().optional(), - theme: z.string().optional(), - leafCount: z.number().int().optional(), - childCount: z.number().int().optional(), - isContinuingSeries: z.boolean().optional(), - skipChildren: z.boolean().optional(), - availabilityId: z.string().optional(), - streamingMediaId: z.string().optional(), - playableKey: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - Image: "image", - }); - }); - - export type Outbound = { - art?: string | undefined; - guid?: string | undefined; - key?: string | undefined; - ratingKey?: string | undefined; - studio?: string | undefined; - tagline?: string | undefined; - type?: string | undefined; - thumb?: string | undefined; - addedAt?: number | undefined; - duration?: number | undefined; - publicPagesURL?: string | undefined; - slug?: string | undefined; - userState?: boolean | undefined; - title?: string | undefined; - contentRating?: string | undefined; - originallyAvailableAt?: string | undefined; - year?: number | undefined; - Image?: Array | undefined; - banner?: string | undefined; - rating?: number | undefined; - expiresAt?: number | undefined; - originalTitle?: string | undefined; - audienceRating?: number | undefined; - audienceRatingImage?: string | undefined; - ratingImage?: string | undefined; - imdbRatingCount?: number | undefined; - subtype?: string | undefined; - theme?: string | undefined; - leafCount?: number | undefined; - childCount?: number | undefined; - isContinuingSeries?: boolean | undefined; - skipChildren?: boolean | undefined; - availabilityId?: string | undefined; - streamingMediaId?: string | undefined; - playableKey?: string | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - art: z.string().optional(), - guid: z.string().optional(), - key: z.string().optional(), - ratingKey: z.string().optional(), - studio: z.string().optional(), - tagline: z.string().optional(), - type: z.string().optional(), - thumb: z.string().optional(), - addedAt: z.number().int().optional(), - duration: z.number().int().optional(), - publicPagesURL: z.string().optional(), - slug: z.string().optional(), - userState: z.boolean().optional(), - title: z.string().optional(), - contentRating: z.string().optional(), - originallyAvailableAt: z - .instanceof(RFCDate) - .transform((v) => v.toString()) - .optional(), - year: z.number().int().optional(), - image: z.array(z.lazy(() => Image$.outboundSchema)).optional(), - banner: z.string().optional(), - rating: z.number().optional(), - expiresAt: z.number().int().optional(), - originalTitle: z.string().optional(), - audienceRating: z.number().optional(), - audienceRatingImage: z.string().optional(), - ratingImage: z.string().optional(), - imdbRatingCount: z.number().int().optional(), - subtype: z.string().optional(), - theme: z.string().optional(), - leafCount: z.number().int().optional(), - childCount: z.number().int().optional(), - isContinuingSeries: z.boolean().optional(), - skipChildren: z.boolean().optional(), - availabilityId: z.string().optional(), - streamingMediaId: z.string().optional(), - playableKey: z.string().optional(), - }) - .transform((v) => { - return remap$(v, { - image: "Image", - }); - }); + /** @deprecated use `Metadata$inboundSchema` instead. */ + export const inboundSchema = Metadata$inboundSchema; + /** @deprecated use `Metadata$outboundSchema` instead. */ + export const outboundSchema = Metadata$outboundSchema; + /** @deprecated use `Metadata$Outbound` instead. */ + export type Outbound = Metadata$Outbound; } /** @internal */ +export const GetWatchlistResponseBody$inboundSchema: z.ZodType< + GetWatchlistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + librarySectionID: z.string().optional(), + librarySectionTitle: z.string().optional(), + offset: z.number().int().optional(), + totalSize: z.number().int().optional(), + identifier: z.string().optional(), + size: z.number().int().optional(), + Metadata: z.array(z.lazy(() => Metadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); + }); + +/** @internal */ +export type GetWatchlistResponseBody$Outbound = { + librarySectionID?: string | undefined; + librarySectionTitle?: string | undefined; + offset?: number | undefined; + totalSize?: number | undefined; + identifier?: string | undefined; + size?: number | undefined; + Metadata?: Array | undefined; +}; + +/** @internal */ +export const GetWatchlistResponseBody$outboundSchema: z.ZodType< + GetWatchlistResponseBody$Outbound, + z.ZodTypeDef, + GetWatchlistResponseBody +> = z + .object({ + librarySectionID: z.string().optional(), + librarySectionTitle: z.string().optional(), + offset: z.number().int().optional(), + totalSize: z.number().int().optional(), + identifier: z.string().optional(), + size: z.number().int().optional(), + metadata: z.array(z.lazy(() => Metadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetWatchlistResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - librarySectionID: z.string().optional(), - librarySectionTitle: z.string().optional(), - offset: z.number().int().optional(), - totalSize: z.number().int().optional(), - identifier: z.string().optional(), - size: z.number().int().optional(), - Metadata: z.array(z.lazy(() => Metadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - librarySectionID?: string | undefined; - librarySectionTitle?: string | undefined; - offset?: number | undefined; - totalSize?: number | undefined; - identifier?: string | undefined; - size?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - librarySectionID: z.string().optional(), - librarySectionTitle: z.string().optional(), - offset: z.number().int().optional(), - totalSize: z.number().int().optional(), - identifier: z.string().optional(), - size: z.number().int().optional(), - metadata: z.array(z.lazy(() => Metadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `GetWatchlistResponseBody$inboundSchema` instead. */ + export const inboundSchema = GetWatchlistResponseBody$inboundSchema; + /** @deprecated use `GetWatchlistResponseBody$outboundSchema` instead. */ + export const outboundSchema = GetWatchlistResponseBody$outboundSchema; + /** @deprecated use `GetWatchlistResponseBody$Outbound` instead. */ + export type Outbound = GetWatchlistResponseBody$Outbound; } /** @internal */ +export const GetWatchlistResponse$inboundSchema: z.ZodType< + GetWatchlistResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => GetWatchlistResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type GetWatchlistResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: GetWatchlistResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const GetWatchlistResponse$outboundSchema: z.ZodType< + GetWatchlistResponse$Outbound, + z.ZodTypeDef, + GetWatchlistResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => GetWatchlistResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace GetWatchlistResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => GetWatchlistResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: GetWatchlistResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => GetWatchlistResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `GetWatchlistResponse$inboundSchema` instead. */ + export const inboundSchema = GetWatchlistResponse$inboundSchema; + /** @deprecated use `GetWatchlistResponse$outboundSchema` instead. */ + export const outboundSchema = GetWatchlistResponse$outboundSchema; + /** @deprecated use `GetWatchlistResponse$Outbound` instead. */ + export type Outbound = GetWatchlistResponse$Outbound; } diff --git a/src/models/httpclienterrors.ts b/src/models/httpclienterrors.ts new file mode 100644 index 00000000..cdb2995f --- /dev/null +++ b/src/models/httpclienterrors.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/** + * Base class for all HTTP errors. + */ +export class HTTPClientError extends Error { + /** The underlying cause of the error. */ + override readonly cause: unknown; + override name = "HTTPClientError"; + constructor(message: string, opts?: { cause?: unknown }) { + let msg = message; + if (opts?.cause) { + msg += `: ${opts.cause}`; + } + + super(msg, opts); + // In older runtimes, the cause field would not have been assigned through + // the super() call. + if (typeof this.cause === "undefined") { + this.cause = opts?.cause; + } + } +} + +/** + * An error to capture unrecognised or unexpected errors when making HTTP calls. + */ +export class UnexpectedClientError extends HTTPClientError { + override name = "UnexpectedClientError"; +} + +/** + * An error that is raised when any inputs used to create a request are invalid. + */ +export class InvalidRequestError extends HTTPClientError { + override name = "InvalidRequestError"; +} + +/** + * An error that is raised when a HTTP request was aborted by the client error. + */ +export class RequestAbortedError extends HTTPClientError { + override readonly name = "RequestAbortedError"; +} + +/** + * An error that is raised when a HTTP request timed out due to an AbortSignal + * signal timeout. + */ +export class RequestTimeoutError extends HTTPClientError { + override readonly name = "RequestTimeoutError"; +} + +/** + * An error that is raised when a HTTP client is unable to make a request to + * a server. + */ +export class ConnectionError extends HTTPClientError { + override readonly name = "ConnectionError"; +} diff --git a/src/models/index.ts b/src/models/index.ts index 049b0bfe..296afc6c 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export * from "./addplaylistcontentsop.js"; @@ -14,8 +14,10 @@ export * from "./enablepapertrailop.js"; export * from "./getavailableclientsop.js"; export * from "./getbandwidthstatisticsop.js"; export * from "./getbutlertasksop.js"; +export * from "./getcompanionsdataop.js"; export * from "./getdevicesop.js"; export * from "./getfilehashop.js"; +export * from "./getgeodataop.js"; export * from "./getglobalhubsop.js"; export * from "./gethomedataop.js"; export * from "./getlibrariesop.js"; @@ -32,6 +34,7 @@ export * from "./getplaylistop.js"; export * from "./getplaylistsop.js"; export * from "./getrecentlyaddedop.js"; export * from "./getresizedphotoop.js"; +export * from "./getresourcesop.js"; export * from "./getresourcesstatisticsop.js"; export * from "./getsearchresultsop.js"; export * from "./getserveractivitiesop.js"; @@ -44,18 +47,22 @@ export * from "./getsessionsop.js"; export * from "./getsourceconnectioninformationop.js"; export * from "./getstatisticsop.js"; export * from "./gettimelineop.js"; -export * from "./gettokenop.js"; +export * from "./gettokenbypinidop.js"; export * from "./gettopwatchedcontentop.js"; export * from "./gettranscodesessionsop.js"; export * from "./gettransienttokenop.js"; export * from "./getupdatestatusop.js"; +export * from "./getuserdetailsop.js"; +export * from "./getuserfriendsop.js"; export * from "./getwatchlistop.js"; +export * from "./httpclienterrors.js"; export * from "./loglineop.js"; export * from "./logmultilineop.js"; export * from "./markplayedop.js"; export * from "./markunplayedop.js"; export * from "./performsearchop.js"; export * from "./performvoicesearchop.js"; +export * from "./postuserssignindataop.js"; export * from "./refreshlibraryop.js"; export * from "./sdkerror.js"; export * from "./sdkvalidationerror.js"; diff --git a/src/models/loglineop.ts b/src/models/loglineop.ts index b86c5d45..0d7f420e 100644 --- a/src/models/loglineop.ts +++ b/src/models/loglineop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -78,7 +78,11 @@ export class LogLineResponseBody extends Error { data$: LogLineResponseBodyData; constructor(err: LogLineResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -88,11 +92,6 @@ export class LogLineResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "LogLineResponseBody"; } } @@ -113,130 +112,215 @@ export type LogLineResponse = { }; /** @internal */ +export const Level$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Level); + +/** @internal */ +export const Level$outboundSchema: z.ZodNativeEnum = Level$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Level$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Level); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Level$inboundSchema` instead. */ + export const inboundSchema = Level$inboundSchema; + /** @deprecated use `Level$outboundSchema` instead. */ + export const outboundSchema = Level$outboundSchema; } /** @internal */ +export const LogLineRequest$inboundSchema: z.ZodType = + z.object({ + level: Level$inboundSchema, + message: z.string(), + source: z.string(), + }); + +/** @internal */ +export type LogLineRequest$Outbound = { + level: number; + message: string; + source: string; +}; + +/** @internal */ +export const LogLineRequest$outboundSchema: z.ZodType< + LogLineRequest$Outbound, + z.ZodTypeDef, + LogLineRequest +> = z.object({ + level: Level$outboundSchema, + message: z.string(), + source: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogLineRequest$ { - export const inboundSchema: z.ZodType = z.object({ - level: Level$.inboundSchema, - message: z.string(), - source: z.string(), - }); - - export type Outbound = { - level: number; - message: string; - source: string; - }; - - export const outboundSchema: z.ZodType = z.object({ - level: Level$.outboundSchema, - message: z.string(), - source: z.string(), - }); + /** @deprecated use `LogLineRequest$inboundSchema` instead. */ + export const inboundSchema = LogLineRequest$inboundSchema; + /** @deprecated use `LogLineRequest$outboundSchema` instead. */ + export const outboundSchema = LogLineRequest$outboundSchema; + /** @deprecated use `LogLineRequest$Outbound` instead. */ + export type Outbound = LogLineRequest$Outbound; } /** @internal */ +export const LogLineErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type LogLineErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const LogLineErrors$outboundSchema: z.ZodType< + LogLineErrors$Outbound, + z.ZodTypeDef, + LogLineErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogLineErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `LogLineErrors$inboundSchema` instead. */ + export const inboundSchema = LogLineErrors$inboundSchema; + /** @deprecated use `LogLineErrors$outboundSchema` instead. */ + export const outboundSchema = LogLineErrors$outboundSchema; + /** @deprecated use `LogLineErrors$Outbound` instead. */ + export type Outbound = LogLineErrors$Outbound; } /** @internal */ +export const LogLineResponseBody$inboundSchema: z.ZodType< + LogLineResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => LogLineErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new LogLineResponseBody(remapped); + }); + +/** @internal */ +export type LogLineResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const LogLineResponseBody$outboundSchema: z.ZodType< + LogLineResponseBody$Outbound, + z.ZodTypeDef, + LogLineResponseBody +> = z + .instanceof(LogLineResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => LogLineErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogLineResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => LogLineErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new LogLineResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(LogLineResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => LogLineErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `LogLineResponseBody$inboundSchema` instead. */ + export const inboundSchema = LogLineResponseBody$inboundSchema; + /** @deprecated use `LogLineResponseBody$outboundSchema` instead. */ + export const outboundSchema = LogLineResponseBody$outboundSchema; + /** @deprecated use `LogLineResponseBody$Outbound` instead. */ + export type Outbound = LogLineResponseBody$Outbound; } /** @internal */ +export const LogLineResponse$inboundSchema: z.ZodType = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type LogLineResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const LogLineResponse$outboundSchema: z.ZodType< + LogLineResponse$Outbound, + z.ZodTypeDef, + LogLineResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogLineResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `LogLineResponse$inboundSchema` instead. */ + export const inboundSchema = LogLineResponse$inboundSchema; + /** @deprecated use `LogLineResponse$outboundSchema` instead. */ + export const outboundSchema = LogLineResponse$outboundSchema; + /** @deprecated use `LogLineResponse$Outbound` instead. */ + export type Outbound = LogLineResponse$Outbound; } diff --git a/src/models/logmultilineop.ts b/src/models/logmultilineop.ts index a830feae..aedd5aff 100644 --- a/src/models/logmultilineop.ts +++ b/src/models/logmultilineop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class LogMultiLineResponseBody extends Error { data$: LogMultiLineResponseBodyData; constructor(err: LogMultiLineResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class LogMultiLineResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "LogMultiLineResponseBody"; } } @@ -71,103 +70,166 @@ export type LogMultiLineResponse = { }; /** @internal */ +export const LogMultiLineErrors$inboundSchema: z.ZodType< + LogMultiLineErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type LogMultiLineErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const LogMultiLineErrors$outboundSchema: z.ZodType< + LogMultiLineErrors$Outbound, + z.ZodTypeDef, + LogMultiLineErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogMultiLineErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `LogMultiLineErrors$inboundSchema` instead. */ + export const inboundSchema = LogMultiLineErrors$inboundSchema; + /** @deprecated use `LogMultiLineErrors$outboundSchema` instead. */ + export const outboundSchema = LogMultiLineErrors$outboundSchema; + /** @deprecated use `LogMultiLineErrors$Outbound` instead. */ + export type Outbound = LogMultiLineErrors$Outbound; } /** @internal */ +export const LogMultiLineResponseBody$inboundSchema: z.ZodType< + LogMultiLineResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => LogMultiLineErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new LogMultiLineResponseBody(remapped); + }); + +/** @internal */ +export type LogMultiLineResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const LogMultiLineResponseBody$outboundSchema: z.ZodType< + LogMultiLineResponseBody$Outbound, + z.ZodTypeDef, + LogMultiLineResponseBody +> = z + .instanceof(LogMultiLineResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => LogMultiLineErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogMultiLineResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => LogMultiLineErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new LogMultiLineResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(LogMultiLineResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => LogMultiLineErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `LogMultiLineResponseBody$inboundSchema` instead. */ + export const inboundSchema = LogMultiLineResponseBody$inboundSchema; + /** @deprecated use `LogMultiLineResponseBody$outboundSchema` instead. */ + export const outboundSchema = LogMultiLineResponseBody$outboundSchema; + /** @deprecated use `LogMultiLineResponseBody$Outbound` instead. */ + export type Outbound = LogMultiLineResponseBody$Outbound; } /** @internal */ +export const LogMultiLineResponse$inboundSchema: z.ZodType< + LogMultiLineResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type LogMultiLineResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const LogMultiLineResponse$outboundSchema: z.ZodType< + LogMultiLineResponse$Outbound, + z.ZodTypeDef, + LogMultiLineResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace LogMultiLineResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `LogMultiLineResponse$inboundSchema` instead. */ + export const inboundSchema = LogMultiLineResponse$inboundSchema; + /** @deprecated use `LogMultiLineResponse$outboundSchema` instead. */ + export const outboundSchema = LogMultiLineResponse$outboundSchema; + /** @deprecated use `LogMultiLineResponse$Outbound` instead. */ + export type Outbound = LogMultiLineResponse$Outbound; } diff --git a/src/models/markplayedop.ts b/src/models/markplayedop.ts index f07c0d74..6daa7b55 100644 --- a/src/models/markplayedop.ts +++ b/src/models/markplayedop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class MarkPlayedResponseBody extends Error { data$: MarkPlayedResponseBodyData; constructor(err: MarkPlayedResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class MarkPlayedResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "MarkPlayedResponseBody"; } } @@ -78,118 +77,196 @@ export type MarkPlayedResponse = { }; /** @internal */ +export const MarkPlayedRequest$inboundSchema: z.ZodType = + z.object({ + key: z.number(), + }); + +/** @internal */ +export type MarkPlayedRequest$Outbound = { + key: number; +}; + +/** @internal */ +export const MarkPlayedRequest$outboundSchema: z.ZodType< + MarkPlayedRequest$Outbound, + z.ZodTypeDef, + MarkPlayedRequest +> = z.object({ + key: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkPlayedRequest$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.number(), - }); - - export type Outbound = { - key: number; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.number(), - }); + /** @deprecated use `MarkPlayedRequest$inboundSchema` instead. */ + export const inboundSchema = MarkPlayedRequest$inboundSchema; + /** @deprecated use `MarkPlayedRequest$outboundSchema` instead. */ + export const outboundSchema = MarkPlayedRequest$outboundSchema; + /** @deprecated use `MarkPlayedRequest$Outbound` instead. */ + export type Outbound = MarkPlayedRequest$Outbound; } /** @internal */ +export const MarkPlayedErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type MarkPlayedErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const MarkPlayedErrors$outboundSchema: z.ZodType< + MarkPlayedErrors$Outbound, + z.ZodTypeDef, + MarkPlayedErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkPlayedErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `MarkPlayedErrors$inboundSchema` instead. */ + export const inboundSchema = MarkPlayedErrors$inboundSchema; + /** @deprecated use `MarkPlayedErrors$outboundSchema` instead. */ + export const outboundSchema = MarkPlayedErrors$outboundSchema; + /** @deprecated use `MarkPlayedErrors$Outbound` instead. */ + export type Outbound = MarkPlayedErrors$Outbound; } /** @internal */ +export const MarkPlayedResponseBody$inboundSchema: z.ZodType< + MarkPlayedResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => MarkPlayedErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new MarkPlayedResponseBody(remapped); + }); + +/** @internal */ +export type MarkPlayedResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const MarkPlayedResponseBody$outboundSchema: z.ZodType< + MarkPlayedResponseBody$Outbound, + z.ZodTypeDef, + MarkPlayedResponseBody +> = z + .instanceof(MarkPlayedResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => MarkPlayedErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkPlayedResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => MarkPlayedErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new MarkPlayedResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(MarkPlayedResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => MarkPlayedErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `MarkPlayedResponseBody$inboundSchema` instead. */ + export const inboundSchema = MarkPlayedResponseBody$inboundSchema; + /** @deprecated use `MarkPlayedResponseBody$outboundSchema` instead. */ + export const outboundSchema = MarkPlayedResponseBody$outboundSchema; + /** @deprecated use `MarkPlayedResponseBody$Outbound` instead. */ + export type Outbound = MarkPlayedResponseBody$Outbound; } /** @internal */ +export const MarkPlayedResponse$inboundSchema: z.ZodType< + MarkPlayedResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type MarkPlayedResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const MarkPlayedResponse$outboundSchema: z.ZodType< + MarkPlayedResponse$Outbound, + z.ZodTypeDef, + MarkPlayedResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkPlayedResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `MarkPlayedResponse$inboundSchema` instead. */ + export const inboundSchema = MarkPlayedResponse$inboundSchema; + /** @deprecated use `MarkPlayedResponse$outboundSchema` instead. */ + export const outboundSchema = MarkPlayedResponse$outboundSchema; + /** @deprecated use `MarkPlayedResponse$Outbound` instead. */ + export type Outbound = MarkPlayedResponse$Outbound; } diff --git a/src/models/markunplayedop.ts b/src/models/markunplayedop.ts index 532fc02f..0e5313ee 100644 --- a/src/models/markunplayedop.ts +++ b/src/models/markunplayedop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class MarkUnplayedResponseBody extends Error { data$: MarkUnplayedResponseBodyData; constructor(err: MarkUnplayedResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class MarkUnplayedResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "MarkUnplayedResponseBody"; } } @@ -78,118 +77,202 @@ export type MarkUnplayedResponse = { }; /** @internal */ +export const MarkUnplayedRequest$inboundSchema: z.ZodType< + MarkUnplayedRequest, + z.ZodTypeDef, + unknown +> = z.object({ + key: z.number(), +}); + +/** @internal */ +export type MarkUnplayedRequest$Outbound = { + key: number; +}; + +/** @internal */ +export const MarkUnplayedRequest$outboundSchema: z.ZodType< + MarkUnplayedRequest$Outbound, + z.ZodTypeDef, + MarkUnplayedRequest +> = z.object({ + key: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkUnplayedRequest$ { - export const inboundSchema: z.ZodType = z.object({ - key: z.number(), - }); - - export type Outbound = { - key: number; - }; - - export const outboundSchema: z.ZodType = z.object({ - key: z.number(), - }); + /** @deprecated use `MarkUnplayedRequest$inboundSchema` instead. */ + export const inboundSchema = MarkUnplayedRequest$inboundSchema; + /** @deprecated use `MarkUnplayedRequest$outboundSchema` instead. */ + export const outboundSchema = MarkUnplayedRequest$outboundSchema; + /** @deprecated use `MarkUnplayedRequest$Outbound` instead. */ + export type Outbound = MarkUnplayedRequest$Outbound; } /** @internal */ +export const MarkUnplayedErrors$inboundSchema: z.ZodType< + MarkUnplayedErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type MarkUnplayedErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const MarkUnplayedErrors$outboundSchema: z.ZodType< + MarkUnplayedErrors$Outbound, + z.ZodTypeDef, + MarkUnplayedErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkUnplayedErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `MarkUnplayedErrors$inboundSchema` instead. */ + export const inboundSchema = MarkUnplayedErrors$inboundSchema; + /** @deprecated use `MarkUnplayedErrors$outboundSchema` instead. */ + export const outboundSchema = MarkUnplayedErrors$outboundSchema; + /** @deprecated use `MarkUnplayedErrors$Outbound` instead. */ + export type Outbound = MarkUnplayedErrors$Outbound; } /** @internal */ +export const MarkUnplayedResponseBody$inboundSchema: z.ZodType< + MarkUnplayedResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => MarkUnplayedErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new MarkUnplayedResponseBody(remapped); + }); + +/** @internal */ +export type MarkUnplayedResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const MarkUnplayedResponseBody$outboundSchema: z.ZodType< + MarkUnplayedResponseBody$Outbound, + z.ZodTypeDef, + MarkUnplayedResponseBody +> = z + .instanceof(MarkUnplayedResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => MarkUnplayedErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkUnplayedResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => MarkUnplayedErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new MarkUnplayedResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(MarkUnplayedResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => MarkUnplayedErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `MarkUnplayedResponseBody$inboundSchema` instead. */ + export const inboundSchema = MarkUnplayedResponseBody$inboundSchema; + /** @deprecated use `MarkUnplayedResponseBody$outboundSchema` instead. */ + export const outboundSchema = MarkUnplayedResponseBody$outboundSchema; + /** @deprecated use `MarkUnplayedResponseBody$Outbound` instead. */ + export type Outbound = MarkUnplayedResponseBody$Outbound; } /** @internal */ +export const MarkUnplayedResponse$inboundSchema: z.ZodType< + MarkUnplayedResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type MarkUnplayedResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const MarkUnplayedResponse$outboundSchema: z.ZodType< + MarkUnplayedResponse$Outbound, + z.ZodTypeDef, + MarkUnplayedResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace MarkUnplayedResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `MarkUnplayedResponse$inboundSchema` instead. */ + export const inboundSchema = MarkUnplayedResponse$inboundSchema; + /** @deprecated use `MarkUnplayedResponse$outboundSchema` instead. */ + export const outboundSchema = MarkUnplayedResponse$outboundSchema; + /** @deprecated use `MarkUnplayedResponse$Outbound` instead. */ + export type Outbound = MarkUnplayedResponse$Outbound; } diff --git a/src/models/performsearchop.ts b/src/models/performsearchop.ts index 69e6989c..bc46b107 100644 --- a/src/models/performsearchop.ts +++ b/src/models/performsearchop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -51,7 +51,11 @@ export class PerformSearchResponseBody extends Error { data$: PerformSearchResponseBodyData; constructor(err: PerformSearchResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -61,11 +65,6 @@ export class PerformSearchResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "PerformSearchResponseBody"; } } @@ -86,126 +85,208 @@ export type PerformSearchResponse = { }; /** @internal */ +export const PerformSearchRequest$inboundSchema: z.ZodType< + PerformSearchRequest, + z.ZodTypeDef, + unknown +> = z.object({ + query: z.string(), + sectionId: z.number().optional(), + limit: z.number().default(3), +}); + +/** @internal */ +export type PerformSearchRequest$Outbound = { + query: string; + sectionId?: number | undefined; + limit: number; +}; + +/** @internal */ +export const PerformSearchRequest$outboundSchema: z.ZodType< + PerformSearchRequest$Outbound, + z.ZodTypeDef, + PerformSearchRequest +> = z.object({ + query: z.string(), + sectionId: z.number().optional(), + limit: z.number().default(3), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformSearchRequest$ { - export const inboundSchema: z.ZodType = z.object({ - query: z.string(), - sectionId: z.number().optional(), - limit: z.number().default(3), - }); - - export type Outbound = { - query: string; - sectionId?: number | undefined; - limit: number; - }; - - export const outboundSchema: z.ZodType = z.object( - { - query: z.string(), - sectionId: z.number().optional(), - limit: z.number().default(3), - } - ); + /** @deprecated use `PerformSearchRequest$inboundSchema` instead. */ + export const inboundSchema = PerformSearchRequest$inboundSchema; + /** @deprecated use `PerformSearchRequest$outboundSchema` instead. */ + export const outboundSchema = PerformSearchRequest$outboundSchema; + /** @deprecated use `PerformSearchRequest$Outbound` instead. */ + export type Outbound = PerformSearchRequest$Outbound; } /** @internal */ +export const PerformSearchErrors$inboundSchema: z.ZodType< + PerformSearchErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type PerformSearchErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const PerformSearchErrors$outboundSchema: z.ZodType< + PerformSearchErrors$Outbound, + z.ZodTypeDef, + PerformSearchErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformSearchErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `PerformSearchErrors$inboundSchema` instead. */ + export const inboundSchema = PerformSearchErrors$inboundSchema; + /** @deprecated use `PerformSearchErrors$outboundSchema` instead. */ + export const outboundSchema = PerformSearchErrors$outboundSchema; + /** @deprecated use `PerformSearchErrors$Outbound` instead. */ + export type Outbound = PerformSearchErrors$Outbound; } /** @internal */ +export const PerformSearchResponseBody$inboundSchema: z.ZodType< + PerformSearchResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => PerformSearchErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new PerformSearchResponseBody(remapped); + }); + +/** @internal */ +export type PerformSearchResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const PerformSearchResponseBody$outboundSchema: z.ZodType< + PerformSearchResponseBody$Outbound, + z.ZodTypeDef, + PerformSearchResponseBody +> = z + .instanceof(PerformSearchResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => PerformSearchErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformSearchResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => PerformSearchErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new PerformSearchResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(PerformSearchResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => PerformSearchErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `PerformSearchResponseBody$inboundSchema` instead. */ + export const inboundSchema = PerformSearchResponseBody$inboundSchema; + /** @deprecated use `PerformSearchResponseBody$outboundSchema` instead. */ + export const outboundSchema = PerformSearchResponseBody$outboundSchema; + /** @deprecated use `PerformSearchResponseBody$Outbound` instead. */ + export type Outbound = PerformSearchResponseBody$Outbound; } /** @internal */ +export const PerformSearchResponse$inboundSchema: z.ZodType< + PerformSearchResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type PerformSearchResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const PerformSearchResponse$outboundSchema: z.ZodType< + PerformSearchResponse$Outbound, + z.ZodTypeDef, + PerformSearchResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformSearchResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `PerformSearchResponse$inboundSchema` instead. */ + export const inboundSchema = PerformSearchResponse$inboundSchema; + /** @deprecated use `PerformSearchResponse$outboundSchema` instead. */ + export const outboundSchema = PerformSearchResponse$outboundSchema; + /** @deprecated use `PerformSearchResponse$Outbound` instead. */ + export type Outbound = PerformSearchResponse$Outbound; } diff --git a/src/models/performvoicesearchop.ts b/src/models/performvoicesearchop.ts index d2bfc81a..747dca88 100644 --- a/src/models/performvoicesearchop.ts +++ b/src/models/performvoicesearchop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -51,7 +51,11 @@ export class PerformVoiceSearchResponseBody extends Error { data$: PerformVoiceSearchResponseBodyData; constructor(err: PerformVoiceSearchResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -61,11 +65,6 @@ export class PerformVoiceSearchResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "PerformVoiceSearchResponseBody"; } } @@ -86,131 +85,208 @@ export type PerformVoiceSearchResponse = { }; /** @internal */ +export const PerformVoiceSearchRequest$inboundSchema: z.ZodType< + PerformVoiceSearchRequest, + z.ZodTypeDef, + unknown +> = z.object({ + query: z.string(), + sectionId: z.number().optional(), + limit: z.number().default(3), +}); + +/** @internal */ +export type PerformVoiceSearchRequest$Outbound = { + query: string; + sectionId?: number | undefined; + limit: number; +}; + +/** @internal */ +export const PerformVoiceSearchRequest$outboundSchema: z.ZodType< + PerformVoiceSearchRequest$Outbound, + z.ZodTypeDef, + PerformVoiceSearchRequest +> = z.object({ + query: z.string(), + sectionId: z.number().optional(), + limit: z.number().default(3), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformVoiceSearchRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - query: z.string(), - sectionId: z.number().optional(), - limit: z.number().default(3), - }); - - export type Outbound = { - query: string; - sectionId?: number | undefined; - limit: number; - }; - - export const outboundSchema: z.ZodType = - z.object({ - query: z.string(), - sectionId: z.number().optional(), - limit: z.number().default(3), - }); + /** @deprecated use `PerformVoiceSearchRequest$inboundSchema` instead. */ + export const inboundSchema = PerformVoiceSearchRequest$inboundSchema; + /** @deprecated use `PerformVoiceSearchRequest$outboundSchema` instead. */ + export const outboundSchema = PerformVoiceSearchRequest$outboundSchema; + /** @deprecated use `PerformVoiceSearchRequest$Outbound` instead. */ + export type Outbound = PerformVoiceSearchRequest$Outbound; } /** @internal */ +export const PerformVoiceSearchErrors$inboundSchema: z.ZodType< + PerformVoiceSearchErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type PerformVoiceSearchErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const PerformVoiceSearchErrors$outboundSchema: z.ZodType< + PerformVoiceSearchErrors$Outbound, + z.ZodTypeDef, + PerformVoiceSearchErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformVoiceSearchErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `PerformVoiceSearchErrors$inboundSchema` instead. */ + export const inboundSchema = PerformVoiceSearchErrors$inboundSchema; + /** @deprecated use `PerformVoiceSearchErrors$outboundSchema` instead. */ + export const outboundSchema = PerformVoiceSearchErrors$outboundSchema; + /** @deprecated use `PerformVoiceSearchErrors$Outbound` instead. */ + export type Outbound = PerformVoiceSearchErrors$Outbound; } /** @internal */ -export namespace PerformVoiceSearchResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => PerformVoiceSearchErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new PerformVoiceSearchResponseBody(remapped); +export const PerformVoiceSearchResponseBody$inboundSchema: z.ZodType< + PerformVoiceSearchResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => PerformVoiceSearchErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new PerformVoiceSearchResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type PerformVoiceSearchResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const PerformVoiceSearchResponseBody$outboundSchema: z.ZodType< + PerformVoiceSearchResponseBody$Outbound, + z.ZodTypeDef, + PerformVoiceSearchResponseBody +> = z + .instanceof(PerformVoiceSearchResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(PerformVoiceSearchResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => PerformVoiceSearchErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => PerformVoiceSearchErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PerformVoiceSearchResponseBody$ { + /** @deprecated use `PerformVoiceSearchResponseBody$inboundSchema` instead. */ + export const inboundSchema = PerformVoiceSearchResponseBody$inboundSchema; + /** @deprecated use `PerformVoiceSearchResponseBody$outboundSchema` instead. */ + export const outboundSchema = PerformVoiceSearchResponseBody$outboundSchema; + /** @deprecated use `PerformVoiceSearchResponseBody$Outbound` instead. */ + export type Outbound = PerformVoiceSearchResponseBody$Outbound; } /** @internal */ +export const PerformVoiceSearchResponse$inboundSchema: z.ZodType< + PerformVoiceSearchResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type PerformVoiceSearchResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const PerformVoiceSearchResponse$outboundSchema: z.ZodType< + PerformVoiceSearchResponse$Outbound, + z.ZodTypeDef, + PerformVoiceSearchResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PerformVoiceSearchResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `PerformVoiceSearchResponse$inboundSchema` instead. */ + export const inboundSchema = PerformVoiceSearchResponse$inboundSchema; + /** @deprecated use `PerformVoiceSearchResponse$outboundSchema` instead. */ + export const outboundSchema = PerformVoiceSearchResponse$outboundSchema; + /** @deprecated use `PerformVoiceSearchResponse$Outbound` instead. */ + export type Outbound = PerformVoiceSearchResponse$Outbound; } diff --git a/src/models/postuserssignindataop.ts b/src/models/postuserssignindataop.ts new file mode 100644 index 00000000..75d47865 --- /dev/null +++ b/src/models/postuserssignindataop.ts @@ -0,0 +1,1566 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { remap as remap$ } from "../lib/primitives.js"; +import * as z from "zod"; + +export const PostUsersSigninDataOpServerList = ["https://plex.tv/api/v2"] as const; + +export type PostUsersSigninDataGlobals = { + /** + * The unique identifier for the client application + * + * @remarks + * This is used to track the client application and its usage + * (UUID, serial number, or other number unique per device) + * + */ + xPlexClientIdentifier?: string | undefined; +}; + +/** + * Login credentials + */ +export type PostUsersSigninDataRequestBody = { + login: string; + password: string; + rememberMe?: boolean | undefined; +}; + +export type PostUsersSigninDataRequest = { + /** + * The unique identifier for the client application + * + * @remarks + * This is used to track the client application and its usage + * (UUID, serial number, or other number unique per device) + * + */ + xPlexClientIdentifier?: string | undefined; + /** + * Login credentials + */ + requestBody?: PostUsersSigninDataRequestBody | undefined; +}; + +export type PostUsersSigninDataErrors = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export type PostUsersSigninDataResponseBodyData = { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; +}; + +/** + * Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +export class PostUsersSigninDataResponseBody extends Error { + errors?: Array | undefined; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse?: Response | undefined; + + /** The original data that was passed to this error instance. */ + data$: PostUsersSigninDataResponseBodyData; + + constructor(err: PostUsersSigninDataResponseBodyData) { + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); + this.data$ = err; + + if (err.errors != null) { + this.errors = err.errors; + } + if (err.rawResponse != null) { + this.rawResponse = err.rawResponse; + } + + this.name = "PostUsersSigninDataResponseBody"; + } +} + +/** + * Your current mailing list status + */ +export enum PostUsersSigninDataMailingListStatus { + Subscribed = "subscribed", + Unsubscribed = "unsubscribed", +} + +export type PostUsersSigninDataUserProfile = { + /** + * If the account has automatically select audio and subtitle tracks enabled + */ + autoSelectAudio?: boolean | undefined; + /** + * The preferred audio language for the account + */ + defaultAudioLanguage?: string | undefined; + /** + * The preferred subtitle language for the account + */ + defaultSubtitleLanguage?: string | undefined; + /** + * The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) + */ + autoSelectSubtitle?: number | undefined; + /** + * The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) + */ + defaultSubtitleAccessibility?: number | undefined; + /** + * The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) + */ + defaultSubtitleForced?: number | undefined; + watchedIndicator?: number | undefined; + mediaReviewsVisibility?: number | undefined; +}; + +export enum PostUsersSigninDataStatus { + Online = "online", + Offline = "offline", +} + +export type PostUsersSigninDataServices = { + identifier: string; + endpoint: string; + token: string | null; + secret: string | null; + status: PostUsersSigninDataStatus; +}; + +export enum PostUsersSigninDataFeatures { + AndroidDolbyVision = "Android - Dolby Vision", + AndroidPiP = "Android - PiP", + CUSunset = "CU Sunset", + HRKEnableEUR = "HRK_enable_EUR", + TREBLEShowFeatures = "TREBLE-show-features", + AdCountdownTimer = "ad-countdown-timer", + AdaptiveBitrate = "adaptive_bitrate", + AmazonLoopDebug = "amazon-loop-debug", + AvodAdAnalysis = "avod-ad-analysis", + AvodNewMedia = "avod-new-media", + BlacklistGetSignin = "blacklist_get_signin", + ClientRadioStations = "client-radio-stations", + CloudflareTurnstileRequired = "cloudflare-turnstile-required", + Collections = "collections", + CommentsAndRepliesPushNotifications = "comments_and_replies_push_notifications", + CommunityAccessPlexTv = "community_access_plex_tv", + CompanionsSonos = "companions_sonos", + CustomHomeRemoval = "custom-home-removal", + DisableHomeUserFriendships = "disable_home_user_friendships", + DisableSharingFriendships = "disable_sharing_friendships", + DrmSupport = "drm_support", + ExcludeRestrictions = "exclude restrictions", + FederatedAuth = "federated-auth", + FriendRequestPushNotifications = "friend_request_push_notifications", + GuidedUpgrade = "guided-upgrade", + Home = "home", + IncreasePasswordComplexity = "increase-password-complexity", + Ios14PrivacyBanner = "ios14-privacy-banner", + IterableNotificationTokens = "iterable-notification-tokens", + KeepPaymentMethod = "keep-payment-method", + KevinBacon = "kevin-bacon", + KoreaConsent = "korea-consent", + LeIsrgRootX1 = "le_isrg_root_x1", + LetsEncrypt = "lets_encrypt", + LightningDvrPivot = "lightning-dvr-pivot", + LiveTvSupportIncompleteSegments = "live-tv-support-incomplete-segments", + Livetv = "livetv", + MetadataSearch = "metadata_search", + NewPlexPassPrices = "new_plex_pass_prices", + NewsProviderSunsetModal = "news-provider-sunset-modal", + PhotosFavorites = "photos-favorites", + PhotosMetadataEdition = "photos-metadata-edition", + PmsHealth = "pms_health", + Radio = "radio", + RateLimitClientToken = "rate-limit-client-token", + ScrobblingServicePlexTv = "scrobbling-service-plex-tv", + SharedServerNotification = "shared_server_notification", + SharedSourceNotification = "shared_source_notification", + SigninWithApple = "signin_with_apple", + SpringServeAdProvider = "spring_serve_ad_provider", + TranscoderCache = "transcoder_cache", + TunerSharing = "tuner-sharing", + TwoFactorAuthentication = "two-factor-authentication", + Unsupportedtuners = "unsupportedtuners", + Upgrade3ds2 = "upgrade-3ds2", + VodSchema = "vod-schema", + VodCloudflare = "vod_cloudflare", + WatchTogetherInvite = "watch-together-invite", + WebServerDashboard = "web_server_dashboard", +} + +/** + * String representation of subscriptionActive + */ +export enum PostUsersSigninDataUserStatus { + Inactive = "Inactive", + Active = "Active", +} + +/** + * If the account’s Plex Pass subscription is active + */ +export type PostUsersSigninDataSubscription = { + /** + * List of features allowed on your Plex Pass subscription + */ + features?: Array | undefined; + /** + * If the account's Plex Pass subscription is active + */ + active?: boolean | undefined; + /** + * Date the account subscribed to Plex Pass + */ + subscribedAt?: Date | undefined; + /** + * String representation of subscriptionActive + */ + status?: PostUsersSigninDataUserStatus | undefined; + /** + * Payment service used for your Plex Pass subscription + */ + paymentService?: string | null | undefined; + /** + * Name of Plex Pass subscription plan + */ + plan?: string | null | undefined; +}; + +export enum PostUsersSigninDataUserFeatures { + AndroidDolbyVision = "Android - Dolby Vision", + AndroidPiP = "Android - PiP", + CUSunset = "CU Sunset", + HRKEnableEUR = "HRK_enable_EUR", + TREBLEShowFeatures = "TREBLE-show-features", + AdCountdownTimer = "ad-countdown-timer", + AdaptiveBitrate = "adaptive_bitrate", + AmazonLoopDebug = "amazon-loop-debug", + AvodAdAnalysis = "avod-ad-analysis", + AvodNewMedia = "avod-new-media", + BlacklistGetSignin = "blacklist_get_signin", + ClientRadioStations = "client-radio-stations", + CloudflareTurnstileRequired = "cloudflare-turnstile-required", + Collections = "collections", + CommentsAndRepliesPushNotifications = "comments_and_replies_push_notifications", + CommunityAccessPlexTv = "community_access_plex_tv", + CompanionsSonos = "companions_sonos", + CustomHomeRemoval = "custom-home-removal", + DisableHomeUserFriendships = "disable_home_user_friendships", + DisableSharingFriendships = "disable_sharing_friendships", + DrmSupport = "drm_support", + ExcludeRestrictions = "exclude restrictions", + FederatedAuth = "federated-auth", + FriendRequestPushNotifications = "friend_request_push_notifications", + GuidedUpgrade = "guided-upgrade", + Home = "home", + IncreasePasswordComplexity = "increase-password-complexity", + Ios14PrivacyBanner = "ios14-privacy-banner", + IterableNotificationTokens = "iterable-notification-tokens", + KeepPaymentMethod = "keep-payment-method", + KevinBacon = "kevin-bacon", + KoreaConsent = "korea-consent", + LeIsrgRootX1 = "le_isrg_root_x1", + LetsEncrypt = "lets_encrypt", + LightningDvrPivot = "lightning-dvr-pivot", + LiveTvSupportIncompleteSegments = "live-tv-support-incomplete-segments", + Livetv = "livetv", + MetadataSearch = "metadata_search", + NewPlexPassPrices = "new_plex_pass_prices", + NewsProviderSunsetModal = "news-provider-sunset-modal", + PhotosFavorites = "photos-favorites", + PhotosMetadataEdition = "photos-metadata-edition", + PmsHealth = "pms_health", + Radio = "radio", + RateLimitClientToken = "rate-limit-client-token", + ScrobblingServicePlexTv = "scrobbling-service-plex-tv", + SharedServerNotification = "shared_server_notification", + SharedSourceNotification = "shared_source_notification", + SigninWithApple = "signin_with_apple", + SpringServeAdProvider = "spring_serve_ad_provider", + TranscoderCache = "transcoder_cache", + TunerSharing = "tuner-sharing", + TwoFactorAuthentication = "two-factor-authentication", + Unsupportedtuners = "unsupportedtuners", + Upgrade3ds2 = "upgrade-3ds2", + VodSchema = "vod-schema", + VodCloudflare = "vod_cloudflare", + WatchTogetherInvite = "watch-together-invite", + WebServerDashboard = "web_server_dashboard", +} + +/** + * String representation of subscriptionActive + */ +export enum PostUsersSigninDataUserResponseStatus { + Inactive = "Inactive", + Active = "Active", +} + +export type PostUsersSigninDataUserSubscription = { + /** + * List of features allowed on your Plex Pass subscription + */ + features?: Array | undefined; + /** + * If the account's Plex Pass subscription is active + */ + active?: boolean | undefined; + /** + * Date the account subscribed to Plex Pass + */ + subscribedAt?: Date | undefined; + /** + * String representation of subscriptionActive + */ + status?: PostUsersSigninDataUserResponseStatus | undefined; + /** + * Payment service used for your Plex Pass subscription + */ + paymentService?: string | null | undefined; + /** + * Name of Plex Pass subscription plan + */ + plan?: string | null | undefined; +}; + +export enum PostUsersSigninDataState { + Ended = "ended", +} + +export type InternalPaymentMethod = {}; + +export type Billing = { + internalPaymentMethod: InternalPaymentMethod; + paymentMethodId: number | null; +}; + +export type PastSubscription = { + id: string | null; + mode: string | null; + /** + * Unix epoch datetime + */ + renewsAt: number | null; + /** + * Unix epoch datetime + */ + endsAt: number | null; + canceled?: boolean | undefined; + gracePeriod?: boolean | undefined; + onHold?: boolean | undefined; + canReactivate?: boolean | undefined; + canUpgrade?: boolean | undefined; + canDowngrade?: boolean | undefined; + canConvert?: boolean | undefined; + type: string; + transfer: string | null; + state: PostUsersSigninDataState; + billing: Array; +}; + +export type Trials = {}; + +/** + * Returns the user account data with a valid auth token + */ +export type PostUsersSigninDataUserPlexAccount = { + /** + * Unknown + */ + adsConsent: boolean | null; + /** + * Unknown + */ + adsConsentReminderAt: Date | null; + /** + * Unknown + */ + adsConsentSetAt: Date | null; + /** + * Unknown + */ + anonymous?: boolean | undefined; + /** + * The account token + */ + authToken: string; + /** + * If the two-factor authentication backup codes have been created + */ + backupCodesCreated?: boolean | undefined; + /** + * If the account has been confirmed + */ + confirmed?: boolean | undefined; + /** + * The account country + */ + country: string; + /** + * The account email address + */ + email: string; + /** + * If login with email only is enabled + */ + emailOnlyAuth?: boolean | undefined; + /** + * If experimental features are enabled + */ + experimentalFeatures?: boolean | undefined; + /** + * Your account full name + */ + friendlyName: string; + /** + * List of devices your allowed to use with this account + */ + entitlements: Array; + /** + * If the account is a Plex Home guest user + */ + guest?: boolean | undefined; + /** + * If the account has a password + */ + hasPassword?: boolean | undefined; + /** + * If the account is a Plex Home user + */ + home?: boolean | undefined; + /** + * If the account is the Plex Home admin + */ + homeAdmin?: boolean | undefined; + /** + * The number of accounts in the Plex Home + */ + homeSize: number; + /** + * The Plex account ID + */ + id: number; + /** + * Unix epoch datetime the account joined Plex + */ + joinedAt: number; + /** + * The account locale + */ + locale: string | null; + /** + * If you are subscribed to the Plex newsletter + */ + mailingListActive?: boolean | undefined; + /** + * Your current mailing list status + */ + mailingListStatus: PostUsersSigninDataMailingListStatus; + /** + * The maximum number of accounts allowed in the Plex Home + */ + maxHomeSize: number; + /** + * [Might be removed] The hashed Plex Home PIN + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + */ + pin?: string | undefined; + profile: Array; + /** + * If the account has a Plex Home PIN enabled + */ + protected?: boolean | undefined; + /** + * Unix epoch datetime the authtoken expires + */ + rememberExpiresAt: number; + /** + * If the account is a Plex Home managed user + */ + restricted?: boolean | undefined; + /** + * [Might be removed] List of account roles. Plexpass membership listed here + */ + roles?: Array | undefined; + /** + * Unknown + */ + scrobbleTypes: string; + services: Array; + /** + * If the account’s Plex Pass subscription is active + */ + subscription: PostUsersSigninDataSubscription; + /** + * Description of the Plex Pass subscription + */ + subscriptionDescription: string | null; + subscriptions: Array; + /** + * URL of the account thumbnail + */ + thumb: string; + /** + * The title of the account (username or friendly name) + */ + title: string; + /** + * If two-factor authentication is enabled + */ + twoFactorEnabled?: boolean | undefined; + /** + * The account username + */ + username: string; + /** + * The account UUID + */ + uuid: string; + pastSubscriptions: Array; + trials: Array; +}; + +export type PostUsersSigninDataResponse = { + /** + * HTTP response content type for this operation + */ + contentType: string; + /** + * HTTP response status code for this operation + */ + statusCode: number; + /** + * Raw HTTP response; suitable for custom response parsing + */ + rawResponse: Response; + /** + * Returns the user account data with a valid auth token + */ + userPlexAccount?: PostUsersSigninDataUserPlexAccount | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataGlobals$inboundSchema: z.ZodType< + PostUsersSigninDataGlobals, + z.ZodTypeDef, + unknown +> = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + }); + }); + +/** @internal */ +export type PostUsersSigninDataGlobals$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataGlobals$outboundSchema: z.ZodType< + PostUsersSigninDataGlobals$Outbound, + z.ZodTypeDef, + PostUsersSigninDataGlobals +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataGlobals$ { + /** @deprecated use `PostUsersSigninDataGlobals$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataGlobals$inboundSchema; + /** @deprecated use `PostUsersSigninDataGlobals$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataGlobals$outboundSchema; + /** @deprecated use `PostUsersSigninDataGlobals$Outbound` instead. */ + export type Outbound = PostUsersSigninDataGlobals$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataRequestBody$inboundSchema: z.ZodType< + PostUsersSigninDataRequestBody, + z.ZodTypeDef, + unknown +> = z.object({ + login: z.string(), + password: z.string(), + rememberMe: z.boolean(), +}); + +/** @internal */ +export type PostUsersSigninDataRequestBody$Outbound = { + login: string; + password: string; + rememberMe: boolean; +}; + +/** @internal */ +export const PostUsersSigninDataRequestBody$outboundSchema: z.ZodType< + PostUsersSigninDataRequestBody$Outbound, + z.ZodTypeDef, + PostUsersSigninDataRequestBody +> = z.object({ + login: z.string(), + password: z.string(), + rememberMe: z.boolean().default(false), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataRequestBody$ { + /** @deprecated use `PostUsersSigninDataRequestBody$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataRequestBody$inboundSchema; + /** @deprecated use `PostUsersSigninDataRequestBody$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataRequestBody$outboundSchema; + /** @deprecated use `PostUsersSigninDataRequestBody$Outbound` instead. */ + export type Outbound = PostUsersSigninDataRequestBody$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataRequest$inboundSchema: z.ZodType< + PostUsersSigninDataRequest, + z.ZodTypeDef, + unknown +> = z + .object({ + "X-Plex-Client-Identifier": z.string().optional(), + RequestBody: z.lazy(() => PostUsersSigninDataRequestBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + "X-Plex-Client-Identifier": "xPlexClientIdentifier", + RequestBody: "requestBody", + }); + }); + +/** @internal */ +export type PostUsersSigninDataRequest$Outbound = { + "X-Plex-Client-Identifier"?: string | undefined; + RequestBody?: PostUsersSigninDataRequestBody$Outbound | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataRequest$outboundSchema: z.ZodType< + PostUsersSigninDataRequest$Outbound, + z.ZodTypeDef, + PostUsersSigninDataRequest +> = z + .object({ + xPlexClientIdentifier: z.string().optional(), + requestBody: z.lazy(() => PostUsersSigninDataRequestBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + xPlexClientIdentifier: "X-Plex-Client-Identifier", + requestBody: "RequestBody", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataRequest$ { + /** @deprecated use `PostUsersSigninDataRequest$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataRequest$inboundSchema; + /** @deprecated use `PostUsersSigninDataRequest$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataRequest$outboundSchema; + /** @deprecated use `PostUsersSigninDataRequest$Outbound` instead. */ + export type Outbound = PostUsersSigninDataRequest$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataErrors$inboundSchema: z.ZodType< + PostUsersSigninDataErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type PostUsersSigninDataErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataErrors$outboundSchema: z.ZodType< + PostUsersSigninDataErrors$Outbound, + z.ZodTypeDef, + PostUsersSigninDataErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataErrors$ { + /** @deprecated use `PostUsersSigninDataErrors$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataErrors$inboundSchema; + /** @deprecated use `PostUsersSigninDataErrors$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataErrors$outboundSchema; + /** @deprecated use `PostUsersSigninDataErrors$Outbound` instead. */ + export type Outbound = PostUsersSigninDataErrors$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataResponseBody$inboundSchema: z.ZodType< + PostUsersSigninDataResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => PostUsersSigninDataErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new PostUsersSigninDataResponseBody(remapped); + }); + +/** @internal */ +export type PostUsersSigninDataResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataResponseBody$outboundSchema: z.ZodType< + PostUsersSigninDataResponseBody$Outbound, + z.ZodTypeDef, + PostUsersSigninDataResponseBody +> = z + .instanceof(PostUsersSigninDataResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => PostUsersSigninDataErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataResponseBody$ { + /** @deprecated use `PostUsersSigninDataResponseBody$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataResponseBody$inboundSchema; + /** @deprecated use `PostUsersSigninDataResponseBody$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataResponseBody$outboundSchema; + /** @deprecated use `PostUsersSigninDataResponseBody$Outbound` instead. */ + export type Outbound = PostUsersSigninDataResponseBody$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataMailingListStatus$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataMailingListStatus +> = z.nativeEnum(PostUsersSigninDataMailingListStatus); + +/** @internal */ +export const PostUsersSigninDataMailingListStatus$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataMailingListStatus +> = PostUsersSigninDataMailingListStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataMailingListStatus$ { + /** @deprecated use `PostUsersSigninDataMailingListStatus$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataMailingListStatus$inboundSchema; + /** @deprecated use `PostUsersSigninDataMailingListStatus$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataMailingListStatus$outboundSchema; +} + +/** @internal */ +export const PostUsersSigninDataUserProfile$inboundSchema: z.ZodType< + PostUsersSigninDataUserProfile, + z.ZodTypeDef, + unknown +> = z.object({ + autoSelectAudio: z.boolean().default(true), + defaultAudioLanguage: z.string().optional(), + defaultSubtitleLanguage: z.string().optional(), + autoSelectSubtitle: z.number().int().optional(), + defaultSubtitleAccessibility: z.number().int().optional(), + defaultSubtitleForced: z.number().int().optional(), + watchedIndicator: z.number().int().optional(), + mediaReviewsVisibility: z.number().int().optional(), +}); + +/** @internal */ +export type PostUsersSigninDataUserProfile$Outbound = { + autoSelectAudio: boolean; + defaultAudioLanguage?: string | undefined; + defaultSubtitleLanguage?: string | undefined; + autoSelectSubtitle?: number | undefined; + defaultSubtitleAccessibility?: number | undefined; + defaultSubtitleForced?: number | undefined; + watchedIndicator?: number | undefined; + mediaReviewsVisibility?: number | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataUserProfile$outboundSchema: z.ZodType< + PostUsersSigninDataUserProfile$Outbound, + z.ZodTypeDef, + PostUsersSigninDataUserProfile +> = z.object({ + autoSelectAudio: z.boolean().default(true), + defaultAudioLanguage: z.string().optional(), + defaultSubtitleLanguage: z.string().optional(), + autoSelectSubtitle: z.number().int().optional(), + defaultSubtitleAccessibility: z.number().int().optional(), + defaultSubtitleForced: z.number().int().optional(), + watchedIndicator: z.number().int().optional(), + mediaReviewsVisibility: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataUserProfile$ { + /** @deprecated use `PostUsersSigninDataUserProfile$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataUserProfile$inboundSchema; + /** @deprecated use `PostUsersSigninDataUserProfile$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataUserProfile$outboundSchema; + /** @deprecated use `PostUsersSigninDataUserProfile$Outbound` instead. */ + export type Outbound = PostUsersSigninDataUserProfile$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataStatus$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataStatus +> = z.nativeEnum(PostUsersSigninDataStatus); + +/** @internal */ +export const PostUsersSigninDataStatus$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataStatus +> = PostUsersSigninDataStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataStatus$ { + /** @deprecated use `PostUsersSigninDataStatus$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataStatus$inboundSchema; + /** @deprecated use `PostUsersSigninDataStatus$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataStatus$outboundSchema; +} + +/** @internal */ +export const PostUsersSigninDataServices$inboundSchema: z.ZodType< + PostUsersSigninDataServices, + z.ZodTypeDef, + unknown +> = z.object({ + identifier: z.string(), + endpoint: z.string(), + token: z.nullable(z.string()), + secret: z.nullable(z.string()), + status: PostUsersSigninDataStatus$inboundSchema, +}); + +/** @internal */ +export type PostUsersSigninDataServices$Outbound = { + identifier: string; + endpoint: string; + token: string | null; + secret: string | null; + status: string; +}; + +/** @internal */ +export const PostUsersSigninDataServices$outboundSchema: z.ZodType< + PostUsersSigninDataServices$Outbound, + z.ZodTypeDef, + PostUsersSigninDataServices +> = z.object({ + identifier: z.string(), + endpoint: z.string(), + token: z.nullable(z.string()), + secret: z.nullable(z.string()), + status: PostUsersSigninDataStatus$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataServices$ { + /** @deprecated use `PostUsersSigninDataServices$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataServices$inboundSchema; + /** @deprecated use `PostUsersSigninDataServices$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataServices$outboundSchema; + /** @deprecated use `PostUsersSigninDataServices$Outbound` instead. */ + export type Outbound = PostUsersSigninDataServices$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataFeatures$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataFeatures +> = z.nativeEnum(PostUsersSigninDataFeatures); + +/** @internal */ +export const PostUsersSigninDataFeatures$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataFeatures +> = PostUsersSigninDataFeatures$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataFeatures$ { + /** @deprecated use `PostUsersSigninDataFeatures$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataFeatures$inboundSchema; + /** @deprecated use `PostUsersSigninDataFeatures$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataFeatures$outboundSchema; +} + +/** @internal */ +export const PostUsersSigninDataUserStatus$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataUserStatus +> = z.nativeEnum(PostUsersSigninDataUserStatus); + +/** @internal */ +export const PostUsersSigninDataUserStatus$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataUserStatus +> = PostUsersSigninDataUserStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataUserStatus$ { + /** @deprecated use `PostUsersSigninDataUserStatus$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataUserStatus$inboundSchema; + /** @deprecated use `PostUsersSigninDataUserStatus$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataUserStatus$outboundSchema; +} + +/** @internal */ +export const PostUsersSigninDataSubscription$inboundSchema: z.ZodType< + PostUsersSigninDataSubscription, + z.ZodTypeDef, + unknown +> = z.object({ + features: z.array(PostUsersSigninDataFeatures$inboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + .optional(), + status: PostUsersSigninDataUserStatus$inboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** @internal */ +export type PostUsersSigninDataSubscription$Outbound = { + features?: Array | undefined; + active?: boolean | undefined; + subscribedAt?: string | undefined; + status?: string | undefined; + paymentService?: string | null | undefined; + plan?: string | null | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataSubscription$outboundSchema: z.ZodType< + PostUsersSigninDataSubscription$Outbound, + z.ZodTypeDef, + PostUsersSigninDataSubscription +> = z.object({ + features: z.array(PostUsersSigninDataFeatures$outboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + status: PostUsersSigninDataUserStatus$outboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataSubscription$ { + /** @deprecated use `PostUsersSigninDataSubscription$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataSubscription$inboundSchema; + /** @deprecated use `PostUsersSigninDataSubscription$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataSubscription$outboundSchema; + /** @deprecated use `PostUsersSigninDataSubscription$Outbound` instead. */ + export type Outbound = PostUsersSigninDataSubscription$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataUserFeatures$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataUserFeatures +> = z.nativeEnum(PostUsersSigninDataUserFeatures); + +/** @internal */ +export const PostUsersSigninDataUserFeatures$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataUserFeatures +> = PostUsersSigninDataUserFeatures$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataUserFeatures$ { + /** @deprecated use `PostUsersSigninDataUserFeatures$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataUserFeatures$inboundSchema; + /** @deprecated use `PostUsersSigninDataUserFeatures$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataUserFeatures$outboundSchema; +} + +/** @internal */ +export const PostUsersSigninDataUserResponseStatus$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataUserResponseStatus +> = z.nativeEnum(PostUsersSigninDataUserResponseStatus); + +/** @internal */ +export const PostUsersSigninDataUserResponseStatus$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataUserResponseStatus +> = PostUsersSigninDataUserResponseStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataUserResponseStatus$ { + /** @deprecated use `PostUsersSigninDataUserResponseStatus$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataUserResponseStatus$inboundSchema; + /** @deprecated use `PostUsersSigninDataUserResponseStatus$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataUserResponseStatus$outboundSchema; +} + +/** @internal */ +export const PostUsersSigninDataUserSubscription$inboundSchema: z.ZodType< + PostUsersSigninDataUserSubscription, + z.ZodTypeDef, + unknown +> = z.object({ + features: z.array(PostUsersSigninDataUserFeatures$inboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + .optional(), + status: PostUsersSigninDataUserResponseStatus$inboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** @internal */ +export type PostUsersSigninDataUserSubscription$Outbound = { + features?: Array | undefined; + active?: boolean | undefined; + subscribedAt?: string | undefined; + status?: string | undefined; + paymentService?: string | null | undefined; + plan?: string | null | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataUserSubscription$outboundSchema: z.ZodType< + PostUsersSigninDataUserSubscription$Outbound, + z.ZodTypeDef, + PostUsersSigninDataUserSubscription +> = z.object({ + features: z.array(PostUsersSigninDataUserFeatures$outboundSchema).optional(), + active: z.boolean().optional(), + subscribedAt: z + .date() + .transform((v) => v.toISOString()) + .optional(), + status: PostUsersSigninDataUserResponseStatus$outboundSchema.optional(), + paymentService: z.nullable(z.string()).optional(), + plan: z.nullable(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataUserSubscription$ { + /** @deprecated use `PostUsersSigninDataUserSubscription$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataUserSubscription$inboundSchema; + /** @deprecated use `PostUsersSigninDataUserSubscription$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataUserSubscription$outboundSchema; + /** @deprecated use `PostUsersSigninDataUserSubscription$Outbound` instead. */ + export type Outbound = PostUsersSigninDataUserSubscription$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataState$inboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataState +> = z.nativeEnum(PostUsersSigninDataState); + +/** @internal */ +export const PostUsersSigninDataState$outboundSchema: z.ZodNativeEnum< + typeof PostUsersSigninDataState +> = PostUsersSigninDataState$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataState$ { + /** @deprecated use `PostUsersSigninDataState$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataState$inboundSchema; + /** @deprecated use `PostUsersSigninDataState$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataState$outboundSchema; +} + +/** @internal */ +export const InternalPaymentMethod$inboundSchema: z.ZodType< + InternalPaymentMethod, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type InternalPaymentMethod$Outbound = {}; + +/** @internal */ +export const InternalPaymentMethod$outboundSchema: z.ZodType< + InternalPaymentMethod$Outbound, + z.ZodTypeDef, + InternalPaymentMethod +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace InternalPaymentMethod$ { + /** @deprecated use `InternalPaymentMethod$inboundSchema` instead. */ + export const inboundSchema = InternalPaymentMethod$inboundSchema; + /** @deprecated use `InternalPaymentMethod$outboundSchema` instead. */ + export const outboundSchema = InternalPaymentMethod$outboundSchema; + /** @deprecated use `InternalPaymentMethod$Outbound` instead. */ + export type Outbound = InternalPaymentMethod$Outbound; +} + +/** @internal */ +export const Billing$inboundSchema: z.ZodType = z.object({ + internalPaymentMethod: z.lazy(() => InternalPaymentMethod$inboundSchema), + paymentMethodId: z.nullable(z.number().int()), +}); + +/** @internal */ +export type Billing$Outbound = { + internalPaymentMethod: InternalPaymentMethod$Outbound; + paymentMethodId: number | null; +}; + +/** @internal */ +export const Billing$outboundSchema: z.ZodType = z.object({ + internalPaymentMethod: z.lazy(() => InternalPaymentMethod$outboundSchema), + paymentMethodId: z.nullable(z.number().int()), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Billing$ { + /** @deprecated use `Billing$inboundSchema` instead. */ + export const inboundSchema = Billing$inboundSchema; + /** @deprecated use `Billing$outboundSchema` instead. */ + export const outboundSchema = Billing$outboundSchema; + /** @deprecated use `Billing$Outbound` instead. */ + export type Outbound = Billing$Outbound; +} + +/** @internal */ +export const PastSubscription$inboundSchema: z.ZodType = + z.object({ + id: z.nullable(z.string()), + mode: z.nullable(z.string()), + renewsAt: z.nullable(z.number().int()), + endsAt: z.nullable(z.number().int()), + canceled: z.boolean(), + gracePeriod: z.boolean(), + onHold: z.boolean(), + canReactivate: z.boolean(), + canUpgrade: z.boolean(), + canDowngrade: z.boolean(), + canConvert: z.boolean(), + type: z.string(), + transfer: z.nullable(z.string()), + state: PostUsersSigninDataState$inboundSchema, + billing: z.array(z.lazy(() => Billing$inboundSchema)), + }); + +/** @internal */ +export type PastSubscription$Outbound = { + id: string | null; + mode: string | null; + renewsAt: number | null; + endsAt: number | null; + canceled: boolean; + gracePeriod: boolean; + onHold: boolean; + canReactivate: boolean; + canUpgrade: boolean; + canDowngrade: boolean; + canConvert: boolean; + type: string; + transfer: string | null; + state: string; + billing: Array; +}; + +/** @internal */ +export const PastSubscription$outboundSchema: z.ZodType< + PastSubscription$Outbound, + z.ZodTypeDef, + PastSubscription +> = z.object({ + id: z.nullable(z.string()), + mode: z.nullable(z.string()), + renewsAt: z.nullable(z.number().int()), + endsAt: z.nullable(z.number().int()), + canceled: z.boolean().default(false), + gracePeriod: z.boolean().default(false), + onHold: z.boolean().default(false), + canReactivate: z.boolean().default(false), + canUpgrade: z.boolean().default(false), + canDowngrade: z.boolean().default(false), + canConvert: z.boolean().default(false), + type: z.string(), + transfer: z.nullable(z.string()), + state: PostUsersSigninDataState$outboundSchema, + billing: z.array(z.lazy(() => Billing$outboundSchema)), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PastSubscription$ { + /** @deprecated use `PastSubscription$inboundSchema` instead. */ + export const inboundSchema = PastSubscription$inboundSchema; + /** @deprecated use `PastSubscription$outboundSchema` instead. */ + export const outboundSchema = PastSubscription$outboundSchema; + /** @deprecated use `PastSubscription$Outbound` instead. */ + export type Outbound = PastSubscription$Outbound; +} + +/** @internal */ +export const Trials$inboundSchema: z.ZodType = z.object({}); + +/** @internal */ +export type Trials$Outbound = {}; + +/** @internal */ +export const Trials$outboundSchema: z.ZodType = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Trials$ { + /** @deprecated use `Trials$inboundSchema` instead. */ + export const inboundSchema = Trials$inboundSchema; + /** @deprecated use `Trials$outboundSchema` instead. */ + export const outboundSchema = Trials$outboundSchema; + /** @deprecated use `Trials$Outbound` instead. */ + export type Outbound = Trials$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataUserPlexAccount$inboundSchema: z.ZodType< + PostUsersSigninDataUserPlexAccount, + z.ZodTypeDef, + unknown +> = z.object({ + adsConsent: z.nullable(z.boolean()), + adsConsentReminderAt: z.nullable( + z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + ), + adsConsentSetAt: z.nullable( + z + .string() + .datetime({ offset: true }) + .transform((v) => new Date(v)) + ), + anonymous: z.boolean(), + authToken: z.string(), + backupCodesCreated: z.boolean(), + confirmed: z.boolean(), + country: z.string(), + email: z.string(), + emailOnlyAuth: z.boolean(), + experimentalFeatures: z.boolean(), + friendlyName: z.string(), + entitlements: z.array(z.string()), + guest: z.boolean(), + hasPassword: z.boolean().default(true), + home: z.boolean(), + homeAdmin: z.boolean(), + homeSize: z.number().int(), + id: z.number().int(), + joinedAt: z.number().int(), + locale: z.nullable(z.string()), + mailingListActive: z.boolean(), + mailingListStatus: PostUsersSigninDataMailingListStatus$inboundSchema, + maxHomeSize: z.number().int(), + pin: z.string().optional(), + profile: z.array(z.lazy(() => PostUsersSigninDataUserProfile$inboundSchema)), + protected: z.boolean(), + rememberExpiresAt: z.number().int(), + restricted: z.boolean(), + roles: z.array(z.string()).optional(), + scrobbleTypes: z.string(), + services: z.array(z.lazy(() => PostUsersSigninDataServices$inboundSchema)), + subscription: z.lazy(() => PostUsersSigninDataSubscription$inboundSchema), + subscriptionDescription: z.nullable(z.string()), + subscriptions: z.array(z.lazy(() => PostUsersSigninDataUserSubscription$inboundSchema)), + thumb: z.string(), + title: z.string(), + twoFactorEnabled: z.boolean(), + username: z.string(), + uuid: z.string(), + pastSubscriptions: z.array(z.lazy(() => PastSubscription$inboundSchema)), + trials: z.array(z.lazy(() => Trials$inboundSchema)), +}); + +/** @internal */ +export type PostUsersSigninDataUserPlexAccount$Outbound = { + adsConsent: boolean | null; + adsConsentReminderAt: string | null; + adsConsentSetAt: string | null; + anonymous: boolean; + authToken: string; + backupCodesCreated: boolean; + confirmed: boolean; + country: string; + email: string; + emailOnlyAuth: boolean; + experimentalFeatures: boolean; + friendlyName: string; + entitlements: Array; + guest: boolean; + hasPassword: boolean; + home: boolean; + homeAdmin: boolean; + homeSize: number; + id: number; + joinedAt: number; + locale: string | null; + mailingListActive: boolean; + mailingListStatus: string; + maxHomeSize: number; + pin?: string | undefined; + profile: Array; + protected: boolean; + rememberExpiresAt: number; + restricted: boolean; + roles?: Array | undefined; + scrobbleTypes: string; + services: Array; + subscription: PostUsersSigninDataSubscription$Outbound; + subscriptionDescription: string | null; + subscriptions: Array; + thumb: string; + title: string; + twoFactorEnabled: boolean; + username: string; + uuid: string; + pastSubscriptions: Array; + trials: Array; +}; + +/** @internal */ +export const PostUsersSigninDataUserPlexAccount$outboundSchema: z.ZodType< + PostUsersSigninDataUserPlexAccount$Outbound, + z.ZodTypeDef, + PostUsersSigninDataUserPlexAccount +> = z.object({ + adsConsent: z.nullable(z.boolean()), + adsConsentReminderAt: z.nullable(z.date().transform((v) => v.toISOString())), + adsConsentSetAt: z.nullable(z.date().transform((v) => v.toISOString())), + anonymous: z.boolean().default(false), + authToken: z.string(), + backupCodesCreated: z.boolean().default(false), + confirmed: z.boolean().default(false), + country: z.string(), + email: z.string(), + emailOnlyAuth: z.boolean().default(false), + experimentalFeatures: z.boolean().default(false), + friendlyName: z.string(), + entitlements: z.array(z.string()), + guest: z.boolean().default(false), + hasPassword: z.boolean().default(true), + home: z.boolean().default(false), + homeAdmin: z.boolean().default(false), + homeSize: z.number().int(), + id: z.number().int(), + joinedAt: z.number().int(), + locale: z.nullable(z.string()), + mailingListActive: z.boolean().default(false), + mailingListStatus: PostUsersSigninDataMailingListStatus$outboundSchema, + maxHomeSize: z.number().int(), + pin: z.string().optional(), + profile: z.array(z.lazy(() => PostUsersSigninDataUserProfile$outboundSchema)), + protected: z.boolean().default(false), + rememberExpiresAt: z.number().int(), + restricted: z.boolean().default(false), + roles: z.array(z.string()).optional(), + scrobbleTypes: z.string(), + services: z.array(z.lazy(() => PostUsersSigninDataServices$outboundSchema)), + subscription: z.lazy(() => PostUsersSigninDataSubscription$outboundSchema), + subscriptionDescription: z.nullable(z.string()), + subscriptions: z.array(z.lazy(() => PostUsersSigninDataUserSubscription$outboundSchema)), + thumb: z.string(), + title: z.string(), + twoFactorEnabled: z.boolean().default(false), + username: z.string(), + uuid: z.string(), + pastSubscriptions: z.array(z.lazy(() => PastSubscription$outboundSchema)), + trials: z.array(z.lazy(() => Trials$outboundSchema)), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataUserPlexAccount$ { + /** @deprecated use `PostUsersSigninDataUserPlexAccount$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataUserPlexAccount$inboundSchema; + /** @deprecated use `PostUsersSigninDataUserPlexAccount$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataUserPlexAccount$outboundSchema; + /** @deprecated use `PostUsersSigninDataUserPlexAccount$Outbound` instead. */ + export type Outbound = PostUsersSigninDataUserPlexAccount$Outbound; +} + +/** @internal */ +export const PostUsersSigninDataResponse$inboundSchema: z.ZodType< + PostUsersSigninDataResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + UserPlexAccount: z.lazy(() => PostUsersSigninDataUserPlexAccount$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + UserPlexAccount: "userPlexAccount", + }); + }); + +/** @internal */ +export type PostUsersSigninDataResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + UserPlexAccount?: PostUsersSigninDataUserPlexAccount$Outbound | undefined; +}; + +/** @internal */ +export const PostUsersSigninDataResponse$outboundSchema: z.ZodType< + PostUsersSigninDataResponse$Outbound, + z.ZodTypeDef, + PostUsersSigninDataResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + userPlexAccount: z.lazy(() => PostUsersSigninDataUserPlexAccount$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + userPlexAccount: "UserPlexAccount", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PostUsersSigninDataResponse$ { + /** @deprecated use `PostUsersSigninDataResponse$inboundSchema` instead. */ + export const inboundSchema = PostUsersSigninDataResponse$inboundSchema; + /** @deprecated use `PostUsersSigninDataResponse$outboundSchema` instead. */ + export const outboundSchema = PostUsersSigninDataResponse$outboundSchema; + /** @deprecated use `PostUsersSigninDataResponse$Outbound` instead. */ + export type Outbound = PostUsersSigninDataResponse$Outbound; +} diff --git a/src/models/refreshlibraryop.ts b/src/models/refreshlibraryop.ts index d2897579..4b816abf 100644 --- a/src/models/refreshlibraryop.ts +++ b/src/models/refreshlibraryop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class RefreshLibraryResponseBody extends Error { data$: RefreshLibraryResponseBodyData; constructor(err: RefreshLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class RefreshLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "RefreshLibraryResponseBody"; } } @@ -78,121 +77,202 @@ export type RefreshLibraryResponse = { }; /** @internal */ +export const RefreshLibraryRequest$inboundSchema: z.ZodType< + RefreshLibraryRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sectionId: z.number(), +}); + +/** @internal */ +export type RefreshLibraryRequest$Outbound = { + sectionId: number; +}; + +/** @internal */ +export const RefreshLibraryRequest$outboundSchema: z.ZodType< + RefreshLibraryRequest$Outbound, + z.ZodTypeDef, + RefreshLibraryRequest +> = z.object({ + sectionId: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace RefreshLibraryRequest$ { - export const inboundSchema: z.ZodType = z.object({ - sectionId: z.number(), - }); - - export type Outbound = { - sectionId: number; - }; - - export const outboundSchema: z.ZodType = - z.object({ - sectionId: z.number(), - }); + /** @deprecated use `RefreshLibraryRequest$inboundSchema` instead. */ + export const inboundSchema = RefreshLibraryRequest$inboundSchema; + /** @deprecated use `RefreshLibraryRequest$outboundSchema` instead. */ + export const outboundSchema = RefreshLibraryRequest$outboundSchema; + /** @deprecated use `RefreshLibraryRequest$Outbound` instead. */ + export type Outbound = RefreshLibraryRequest$Outbound; } /** @internal */ +export const RefreshLibraryErrors$inboundSchema: z.ZodType< + RefreshLibraryErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type RefreshLibraryErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const RefreshLibraryErrors$outboundSchema: z.ZodType< + RefreshLibraryErrors$Outbound, + z.ZodTypeDef, + RefreshLibraryErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace RefreshLibraryErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `RefreshLibraryErrors$inboundSchema` instead. */ + export const inboundSchema = RefreshLibraryErrors$inboundSchema; + /** @deprecated use `RefreshLibraryErrors$outboundSchema` instead. */ + export const outboundSchema = RefreshLibraryErrors$outboundSchema; + /** @deprecated use `RefreshLibraryErrors$Outbound` instead. */ + export type Outbound = RefreshLibraryErrors$Outbound; +} + +/** @internal */ +export const RefreshLibraryResponseBody$inboundSchema: z.ZodType< + RefreshLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => RefreshLibraryErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new RefreshLibraryResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; +/** @internal */ +export type RefreshLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } +/** @internal */ +export const RefreshLibraryResponseBody$outboundSchema: z.ZodType< + RefreshLibraryResponseBody$Outbound, + z.ZodTypeDef, + RefreshLibraryResponseBody +> = z + .instanceof(RefreshLibraryResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => RefreshLibraryErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); -} -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace RefreshLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => RefreshLibraryErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new RefreshLibraryResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(RefreshLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => RefreshLibraryErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `RefreshLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = RefreshLibraryResponseBody$inboundSchema; + /** @deprecated use `RefreshLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = RefreshLibraryResponseBody$outboundSchema; + /** @deprecated use `RefreshLibraryResponseBody$Outbound` instead. */ + export type Outbound = RefreshLibraryResponseBody$Outbound; } /** @internal */ +export const RefreshLibraryResponse$inboundSchema: z.ZodType< + RefreshLibraryResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type RefreshLibraryResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const RefreshLibraryResponse$outboundSchema: z.ZodType< + RefreshLibraryResponse$Outbound, + z.ZodTypeDef, + RefreshLibraryResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace RefreshLibraryResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `RefreshLibraryResponse$inboundSchema` instead. */ + export const inboundSchema = RefreshLibraryResponse$inboundSchema; + /** @deprecated use `RefreshLibraryResponse$outboundSchema` instead. */ + export const outboundSchema = RefreshLibraryResponse$outboundSchema; + /** @deprecated use `RefreshLibraryResponse$Outbound` instead. */ + export type Outbound = RefreshLibraryResponse$Outbound; } diff --git a/src/models/sdkerror.ts b/src/models/sdkerror.ts index 5a94e842..80e3aa42 100644 --- a/src/models/sdkerror.ts +++ b/src/models/sdkerror.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export class SDKError extends Error { diff --git a/src/models/sdkvalidationerror.ts b/src/models/sdkvalidationerror.ts index 5eb92182..16929b9e 100644 --- a/src/models/sdkvalidationerror.ts +++ b/src/models/sdkvalidationerror.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; @@ -10,15 +10,17 @@ export class SDKValidationError extends Error { */ public readonly rawValue: unknown; + /** + * The raw message that failed validation. + */ + public readonly rawMessage: unknown; + constructor(message: string, cause: unknown, rawValue: unknown) { - super(message); + super(`${message}: ${cause}`); this.name = "SDKValidationError"; this.cause = cause; this.rawValue = rawValue; - } - - public override toString(): string { - return `${this.message}: ${this.cause}`; + this.rawMessage = message; } /** @@ -28,7 +30,7 @@ export class SDKValidationError extends Error { */ public pretty(): string { if (this.cause instanceof z.ZodError) { - return `${this.message}\n${formatZodError(this.cause)}`; + return `${this.rawMessage}\n${formatZodError(this.cause)}`; } else { return this.toString(); } diff --git a/src/models/searchlibraryop.ts b/src/models/searchlibraryop.ts index 35bfd133..727b6aa7 100644 --- a/src/models/searchlibraryop.ts +++ b/src/models/searchlibraryop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -57,7 +57,11 @@ export class SearchLibraryLibraryResponseBody extends Error { data$: SearchLibraryLibraryResponseBodyData; constructor(err: SearchLibraryLibraryResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -67,11 +71,6 @@ export class SearchLibraryLibraryResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "SearchLibraryLibraryResponseBody"; } } @@ -142,300 +141,450 @@ export type SearchLibraryResponse = { }; /** @internal */ +export const Type$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Type); + +/** @internal */ +export const Type$outboundSchema: z.ZodNativeEnum = Type$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Type$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Type); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Type$inboundSchema` instead. */ + export const inboundSchema = Type$inboundSchema; + /** @deprecated use `Type$outboundSchema` instead. */ + export const outboundSchema = Type$outboundSchema; } /** @internal */ +export const SearchLibraryRequest$inboundSchema: z.ZodType< + SearchLibraryRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sectionId: z.number().int(), + type: Type$inboundSchema, +}); + +/** @internal */ +export type SearchLibraryRequest$Outbound = { + sectionId: number; + type: number; +}; + +/** @internal */ +export const SearchLibraryRequest$outboundSchema: z.ZodType< + SearchLibraryRequest$Outbound, + z.ZodTypeDef, + SearchLibraryRequest +> = z.object({ + sectionId: z.number().int(), + type: Type$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace SearchLibraryRequest$ { - export const inboundSchema: z.ZodType = z.object({ - sectionId: z.number().int(), - type: Type$.inboundSchema, - }); - - export type Outbound = { - sectionId: number; - type: number; - }; - - export const outboundSchema: z.ZodType = z.object( - { - sectionId: z.number().int(), - type: Type$.outboundSchema, - } - ); + /** @deprecated use `SearchLibraryRequest$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryRequest$inboundSchema; + /** @deprecated use `SearchLibraryRequest$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryRequest$outboundSchema; + /** @deprecated use `SearchLibraryRequest$Outbound` instead. */ + export type Outbound = SearchLibraryRequest$Outbound; } /** @internal */ +export const SearchLibraryErrors$inboundSchema: z.ZodType< + SearchLibraryErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type SearchLibraryErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const SearchLibraryErrors$outboundSchema: z.ZodType< + SearchLibraryErrors$Outbound, + z.ZodTypeDef, + SearchLibraryErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace SearchLibraryErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `SearchLibraryErrors$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryErrors$inboundSchema; + /** @deprecated use `SearchLibraryErrors$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryErrors$outboundSchema; + /** @deprecated use `SearchLibraryErrors$Outbound` instead. */ + export type Outbound = SearchLibraryErrors$Outbound; } /** @internal */ -export namespace SearchLibraryLibraryResponseBody$ { - export const inboundSchema: z.ZodType = +export const SearchLibraryLibraryResponseBody$inboundSchema: z.ZodType< + SearchLibraryLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => SearchLibraryErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new SearchLibraryLibraryResponseBody(remapped); + }); + +/** @internal */ +export type SearchLibraryLibraryResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const SearchLibraryLibraryResponseBody$outboundSchema: z.ZodType< + SearchLibraryLibraryResponseBody$Outbound, + z.ZodTypeDef, + SearchLibraryLibraryResponseBody +> = z + .instanceof(SearchLibraryLibraryResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => SearchLibraryErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => SearchLibraryErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new SearchLibraryLibraryResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - SearchLibraryLibraryResponseBody - > = z - .instanceof(SearchLibraryLibraryResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => SearchLibraryErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SearchLibraryLibraryResponseBody$ { + /** @deprecated use `SearchLibraryLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryLibraryResponseBody$inboundSchema; + /** @deprecated use `SearchLibraryLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryLibraryResponseBody$outboundSchema; + /** @deprecated use `SearchLibraryLibraryResponseBody$Outbound` instead. */ + export type Outbound = SearchLibraryLibraryResponseBody$Outbound; } /** @internal */ +export const SearchLibraryMetadata$inboundSchema: z.ZodType< + SearchLibraryMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + parentRatingKey: z.string().optional(), + guid: z.string().optional(), + parentGuid: z.string().optional(), + parentStudio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + parentKey: z.string().optional(), + parentTitle: z.string().optional(), + summary: z.string().optional(), + index: z.number().int().optional(), + parentIndex: z.number().int().optional(), + parentYear: z.number().int().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** @internal */ +export type SearchLibraryMetadata$Outbound = { + ratingKey?: string | undefined; + key?: string | undefined; + parentRatingKey?: string | undefined; + guid?: string | undefined; + parentGuid?: string | undefined; + parentStudio?: string | undefined; + type?: string | undefined; + title?: string | undefined; + parentKey?: string | undefined; + parentTitle?: string | undefined; + summary?: string | undefined; + index?: number | undefined; + parentIndex?: number | undefined; + parentYear?: number | undefined; + thumb?: string | undefined; + art?: string | undefined; + parentThumb?: string | undefined; + parentTheme?: string | undefined; + addedAt?: number | undefined; + updatedAt?: number | undefined; +}; + +/** @internal */ +export const SearchLibraryMetadata$outboundSchema: z.ZodType< + SearchLibraryMetadata$Outbound, + z.ZodTypeDef, + SearchLibraryMetadata +> = z.object({ + ratingKey: z.string().optional(), + key: z.string().optional(), + parentRatingKey: z.string().optional(), + guid: z.string().optional(), + parentGuid: z.string().optional(), + parentStudio: z.string().optional(), + type: z.string().optional(), + title: z.string().optional(), + parentKey: z.string().optional(), + parentTitle: z.string().optional(), + summary: z.string().optional(), + index: z.number().int().optional(), + parentIndex: z.number().int().optional(), + parentYear: z.number().int().optional(), + thumb: z.string().optional(), + art: z.string().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace SearchLibraryMetadata$ { - export const inboundSchema: z.ZodType = z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - parentRatingKey: z.string().optional(), - guid: z.string().optional(), - parentGuid: z.string().optional(), - parentStudio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - parentKey: z.string().optional(), - parentTitle: z.string().optional(), - summary: z.string().optional(), - index: z.number().int().optional(), - parentIndex: z.number().int().optional(), - parentYear: z.number().int().optional(), - thumb: z.string().optional(), + /** @deprecated use `SearchLibraryMetadata$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryMetadata$inboundSchema; + /** @deprecated use `SearchLibraryMetadata$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryMetadata$outboundSchema; + /** @deprecated use `SearchLibraryMetadata$Outbound` instead. */ + export type Outbound = SearchLibraryMetadata$Outbound; +} + +/** @internal */ +export const SearchLibraryMediaContainer$inboundSchema: z.ZodType< + SearchLibraryMediaContainer, + z.ZodTypeDef, + unknown +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), art: z.string().optional(), - parentThumb: z.string().optional(), - parentTheme: z.string().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + nocache: z.boolean().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + title2: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + Metadata: z.array(z.lazy(() => SearchLibraryMetadata$inboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + Metadata: "metadata", + }); }); - export type Outbound = { - ratingKey?: string | undefined; - key?: string | undefined; - parentRatingKey?: string | undefined; - guid?: string | undefined; - parentGuid?: string | undefined; - parentStudio?: string | undefined; - type?: string | undefined; - title?: string | undefined; - parentKey?: string | undefined; - parentTitle?: string | undefined; - summary?: string | undefined; - index?: number | undefined; - parentIndex?: number | undefined; - parentYear?: number | undefined; - thumb?: string | undefined; - art?: string | undefined; - parentThumb?: string | undefined; - parentTheme?: string | undefined; - addedAt?: number | undefined; - updatedAt?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - ratingKey: z.string().optional(), - key: z.string().optional(), - parentRatingKey: z.string().optional(), - guid: z.string().optional(), - parentGuid: z.string().optional(), - parentStudio: z.string().optional(), - type: z.string().optional(), - title: z.string().optional(), - parentKey: z.string().optional(), - parentTitle: z.string().optional(), - summary: z.string().optional(), - index: z.number().int().optional(), - parentIndex: z.number().int().optional(), - parentYear: z.number().int().optional(), - thumb: z.string().optional(), - art: z.string().optional(), - parentThumb: z.string().optional(), - parentTheme: z.string().optional(), - addedAt: z.number().int().optional(), - updatedAt: z.number().int().optional(), - }); -} +/** @internal */ +export type SearchLibraryMediaContainer$Outbound = { + size?: number | undefined; + allowSync?: boolean | undefined; + art?: string | undefined; + identifier?: string | undefined; + mediaTagPrefix?: string | undefined; + mediaTagVersion?: number | undefined; + nocache?: boolean | undefined; + thumb?: string | undefined; + title1?: string | undefined; + title2?: string | undefined; + viewGroup?: string | undefined; + viewMode?: number | undefined; + Metadata?: Array | undefined; +}; /** @internal */ +export const SearchLibraryMediaContainer$outboundSchema: z.ZodType< + SearchLibraryMediaContainer$Outbound, + z.ZodTypeDef, + SearchLibraryMediaContainer +> = z + .object({ + size: z.number().int().optional(), + allowSync: z.boolean().optional(), + art: z.string().optional(), + identifier: z.string().optional(), + mediaTagPrefix: z.string().optional(), + mediaTagVersion: z.number().int().optional(), + nocache: z.boolean().optional(), + thumb: z.string().optional(), + title1: z.string().optional(), + title2: z.string().optional(), + viewGroup: z.string().optional(), + viewMode: z.number().int().optional(), + metadata: z.array(z.lazy(() => SearchLibraryMetadata$outboundSchema)).optional(), + }) + .transform((v) => { + return remap$(v, { + metadata: "Metadata", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace SearchLibraryMediaContainer$ { - export const inboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - nocache: z.boolean().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - title2: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - Metadata: z.array(z.lazy(() => SearchLibraryMetadata$.inboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - Metadata: "metadata", - }); - }); - - export type Outbound = { - size?: number | undefined; - allowSync?: boolean | undefined; - art?: string | undefined; - identifier?: string | undefined; - mediaTagPrefix?: string | undefined; - mediaTagVersion?: number | undefined; - nocache?: boolean | undefined; - thumb?: string | undefined; - title1?: string | undefined; - title2?: string | undefined; - viewGroup?: string | undefined; - viewMode?: number | undefined; - Metadata?: Array | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - size: z.number().int().optional(), - allowSync: z.boolean().optional(), - art: z.string().optional(), - identifier: z.string().optional(), - mediaTagPrefix: z.string().optional(), - mediaTagVersion: z.number().int().optional(), - nocache: z.boolean().optional(), - thumb: z.string().optional(), - title1: z.string().optional(), - title2: z.string().optional(), - viewGroup: z.string().optional(), - viewMode: z.number().int().optional(), - metadata: z.array(z.lazy(() => SearchLibraryMetadata$.outboundSchema)).optional(), - }) - .transform((v) => { - return remap$(v, { - metadata: "Metadata", - }); - }); + /** @deprecated use `SearchLibraryMediaContainer$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryMediaContainer$inboundSchema; + /** @deprecated use `SearchLibraryMediaContainer$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryMediaContainer$outboundSchema; + /** @deprecated use `SearchLibraryMediaContainer$Outbound` instead. */ + export type Outbound = SearchLibraryMediaContainer$Outbound; } /** @internal */ +export const SearchLibraryResponseBody$inboundSchema: z.ZodType< + SearchLibraryResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + MediaContainer: z.lazy(() => SearchLibraryMediaContainer$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + MediaContainer: "mediaContainer", + }); + }); + +/** @internal */ +export type SearchLibraryResponseBody$Outbound = { + MediaContainer?: SearchLibraryMediaContainer$Outbound | undefined; +}; + +/** @internal */ +export const SearchLibraryResponseBody$outboundSchema: z.ZodType< + SearchLibraryResponseBody$Outbound, + z.ZodTypeDef, + SearchLibraryResponseBody +> = z + .object({ + mediaContainer: z.lazy(() => SearchLibraryMediaContainer$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + mediaContainer: "MediaContainer", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace SearchLibraryResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - MediaContainer: z.lazy(() => SearchLibraryMediaContainer$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - MediaContainer: "mediaContainer", - }); - }); - - export type Outbound = { - MediaContainer?: SearchLibraryMediaContainer$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - mediaContainer: z.lazy(() => SearchLibraryMediaContainer$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - mediaContainer: "MediaContainer", - }); - }); + /** @deprecated use `SearchLibraryResponseBody$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryResponseBody$inboundSchema; + /** @deprecated use `SearchLibraryResponseBody$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryResponseBody$outboundSchema; + /** @deprecated use `SearchLibraryResponseBody$Outbound` instead. */ + export type Outbound = SearchLibraryResponseBody$Outbound; } /** @internal */ +export const SearchLibraryResponse$inboundSchema: z.ZodType< + SearchLibraryResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + object: z.lazy(() => SearchLibraryResponseBody$inboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type SearchLibraryResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; + object?: SearchLibraryResponseBody$Outbound | undefined; +}; + +/** @internal */ +export const SearchLibraryResponse$outboundSchema: z.ZodType< + SearchLibraryResponse$Outbound, + z.ZodTypeDef, + SearchLibraryResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + object: z.lazy(() => SearchLibraryResponseBody$outboundSchema).optional(), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace SearchLibraryResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - object: z.lazy(() => SearchLibraryResponseBody$.inboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - object?: SearchLibraryResponseBody$.Outbound | undefined; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - object: z.lazy(() => SearchLibraryResponseBody$.outboundSchema).optional(), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `SearchLibraryResponse$inboundSchema` instead. */ + export const inboundSchema = SearchLibraryResponse$inboundSchema; + /** @deprecated use `SearchLibraryResponse$outboundSchema` instead. */ + export const outboundSchema = SearchLibraryResponse$outboundSchema; + /** @deprecated use `SearchLibraryResponse$Outbound` instead. */ + export type Outbound = SearchLibraryResponse$Outbound; } diff --git a/src/models/security.ts b/src/models/security.ts index 3f861868..37c72148 100644 --- a/src/models/security.ts +++ b/src/models/security.ts @@ -1,24 +1,38 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; export type Security = { - accessToken: string; + accessToken?: string | undefined; }; /** @internal */ +export const Security$inboundSchema: z.ZodType = z.object({ + accessToken: z.string().optional(), +}); + +/** @internal */ +export type Security$Outbound = { + accessToken?: string | undefined; +}; + +/** @internal */ +export const Security$outboundSchema: z.ZodType = + z.object({ + accessToken: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Security$ { - export const inboundSchema: z.ZodType = z.object({ - accessToken: z.string(), - }); - - export type Outbound = { - accessToken: string; - }; - - export const outboundSchema: z.ZodType = z.object({ - accessToken: z.string(), - }); + /** @deprecated use `Security$inboundSchema` instead. */ + export const inboundSchema = Security$inboundSchema; + /** @deprecated use `Security$outboundSchema` instead. */ + export const outboundSchema = Security$outboundSchema; + /** @deprecated use `Security$Outbound` instead. */ + export type Outbound = Security$Outbound; } diff --git a/src/models/startalltasksop.ts b/src/models/startalltasksop.ts index 86927b00..d9271cd9 100644 --- a/src/models/startalltasksop.ts +++ b/src/models/startalltasksop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class StartAllTasksResponseBody extends Error { data$: StartAllTasksResponseBodyData; constructor(err: StartAllTasksResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class StartAllTasksResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "StartAllTasksResponseBody"; } } @@ -71,103 +70,166 @@ export type StartAllTasksResponse = { }; /** @internal */ +export const StartAllTasksErrors$inboundSchema: z.ZodType< + StartAllTasksErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type StartAllTasksErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const StartAllTasksErrors$outboundSchema: z.ZodType< + StartAllTasksErrors$Outbound, + z.ZodTypeDef, + StartAllTasksErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartAllTasksErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `StartAllTasksErrors$inboundSchema` instead. */ + export const inboundSchema = StartAllTasksErrors$inboundSchema; + /** @deprecated use `StartAllTasksErrors$outboundSchema` instead. */ + export const outboundSchema = StartAllTasksErrors$outboundSchema; + /** @deprecated use `StartAllTasksErrors$Outbound` instead. */ + export type Outbound = StartAllTasksErrors$Outbound; } /** @internal */ +export const StartAllTasksResponseBody$inboundSchema: z.ZodType< + StartAllTasksResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => StartAllTasksErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new StartAllTasksResponseBody(remapped); + }); + +/** @internal */ +export type StartAllTasksResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const StartAllTasksResponseBody$outboundSchema: z.ZodType< + StartAllTasksResponseBody$Outbound, + z.ZodTypeDef, + StartAllTasksResponseBody +> = z + .instanceof(StartAllTasksResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => StartAllTasksErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartAllTasksResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => StartAllTasksErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new StartAllTasksResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(StartAllTasksResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => StartAllTasksErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `StartAllTasksResponseBody$inboundSchema` instead. */ + export const inboundSchema = StartAllTasksResponseBody$inboundSchema; + /** @deprecated use `StartAllTasksResponseBody$outboundSchema` instead. */ + export const outboundSchema = StartAllTasksResponseBody$outboundSchema; + /** @deprecated use `StartAllTasksResponseBody$Outbound` instead. */ + export type Outbound = StartAllTasksResponseBody$Outbound; } /** @internal */ +export const StartAllTasksResponse$inboundSchema: z.ZodType< + StartAllTasksResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type StartAllTasksResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const StartAllTasksResponse$outboundSchema: z.ZodType< + StartAllTasksResponse$Outbound, + z.ZodTypeDef, + StartAllTasksResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartAllTasksResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `StartAllTasksResponse$inboundSchema` instead. */ + export const inboundSchema = StartAllTasksResponse$inboundSchema; + /** @deprecated use `StartAllTasksResponse$outboundSchema` instead. */ + export const outboundSchema = StartAllTasksResponse$outboundSchema; + /** @deprecated use `StartAllTasksResponse$Outbound` instead. */ + export type Outbound = StartAllTasksResponse$Outbound; } diff --git a/src/models/starttaskop.ts b/src/models/starttaskop.ts index 8eeca1fb..242d573c 100644 --- a/src/models/starttaskop.ts +++ b/src/models/starttaskop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -63,7 +63,11 @@ export class StartTaskResponseBody extends Error { data$: StartTaskResponseBodyData; constructor(err: StartTaskResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -73,11 +77,6 @@ export class StartTaskResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "StartTaskResponseBody"; } } @@ -98,92 +97,160 @@ export type StartTaskResponse = { }; /** @internal */ +export const TaskName$inboundSchema: z.ZodNativeEnum = z.nativeEnum(TaskName); + +/** @internal */ +export const TaskName$outboundSchema: z.ZodNativeEnum = TaskName$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace TaskName$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(TaskName); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `TaskName$inboundSchema` instead. */ + export const inboundSchema = TaskName$inboundSchema; + /** @deprecated use `TaskName$outboundSchema` instead. */ + export const outboundSchema = TaskName$outboundSchema; } /** @internal */ +export const StartTaskRequest$inboundSchema: z.ZodType = + z.object({ + taskName: TaskName$inboundSchema, + }); + +/** @internal */ +export type StartTaskRequest$Outbound = { + taskName: string; +}; + +/** @internal */ +export const StartTaskRequest$outboundSchema: z.ZodType< + StartTaskRequest$Outbound, + z.ZodTypeDef, + StartTaskRequest +> = z.object({ + taskName: TaskName$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartTaskRequest$ { - export const inboundSchema: z.ZodType = z.object({ - taskName: TaskName$.inboundSchema, - }); - - export type Outbound = { - taskName: string; - }; - - export const outboundSchema: z.ZodType = z.object({ - taskName: TaskName$.outboundSchema, - }); + /** @deprecated use `StartTaskRequest$inboundSchema` instead. */ + export const inboundSchema = StartTaskRequest$inboundSchema; + /** @deprecated use `StartTaskRequest$outboundSchema` instead. */ + export const outboundSchema = StartTaskRequest$outboundSchema; + /** @deprecated use `StartTaskRequest$Outbound` instead. */ + export type Outbound = StartTaskRequest$Outbound; } /** @internal */ +export const StartTaskErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type StartTaskErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const StartTaskErrors$outboundSchema: z.ZodType< + StartTaskErrors$Outbound, + z.ZodTypeDef, + StartTaskErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartTaskErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `StartTaskErrors$inboundSchema` instead. */ + export const inboundSchema = StartTaskErrors$inboundSchema; + /** @deprecated use `StartTaskErrors$outboundSchema` instead. */ + export const outboundSchema = StartTaskErrors$outboundSchema; + /** @deprecated use `StartTaskErrors$Outbound` instead. */ + export type Outbound = StartTaskErrors$Outbound; } /** @internal */ -export namespace StartTaskResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => StartTaskErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new StartTaskResponseBody(remapped); +export const StartTaskResponseBody$inboundSchema: z.ZodType< + StartTaskResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => StartTaskErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new StartTaskResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = z - .instanceof(StartTaskResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => StartTaskErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** @internal */ +export type StartTaskResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const StartTaskResponseBody$outboundSchema: z.ZodType< + StartTaskResponseBody$Outbound, + z.ZodTypeDef, + StartTaskResponseBody +> = z + .instanceof(StartTaskResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => StartTaskErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StartTaskResponseBody$ { + /** @deprecated use `StartTaskResponseBody$inboundSchema` instead. */ + export const inboundSchema = StartTaskResponseBody$inboundSchema; + /** @deprecated use `StartTaskResponseBody$outboundSchema` instead. */ + export const outboundSchema = StartTaskResponseBody$outboundSchema; + /** @deprecated use `StartTaskResponseBody$Outbound` instead. */ + export type Outbound = StartTaskResponseBody$Outbound; } /** @internal */ -export namespace StartTaskResponse$ { - export const inboundSchema: z.ZodType = z +export const StartTaskResponse$inboundSchema: z.ZodType = + z .object({ ContentType: z.string(), StatusCode: z.number().int(), @@ -197,25 +264,43 @@ export namespace StartTaskResponse$ { }); }); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; +/** @internal */ +export type StartTaskResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); +/** @internal */ +export const StartTaskResponse$outboundSchema: z.ZodType< + StartTaskResponse$Outbound, + z.ZodTypeDef, + StartTaskResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StartTaskResponse$ { + /** @deprecated use `StartTaskResponse$inboundSchema` instead. */ + export const inboundSchema = StartTaskResponse$inboundSchema; + /** @deprecated use `StartTaskResponse$outboundSchema` instead. */ + export const outboundSchema = StartTaskResponse$outboundSchema; + /** @deprecated use `StartTaskResponse$Outbound` instead. */ + export type Outbound = StartTaskResponse$Outbound; } diff --git a/src/models/startuniversaltranscodeop.ts b/src/models/startuniversaltranscodeop.ts index 77c3e11b..4c50bd3b 100644 --- a/src/models/startuniversaltranscodeop.ts +++ b/src/models/startuniversaltranscodeop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -103,7 +103,11 @@ export class StartUniversalTranscodeResponseBody extends Error { data$: StartUniversalTranscodeResponseBodyData; constructor(err: StartUniversalTranscodeResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -113,11 +117,6 @@ export class StartUniversalTranscodeResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "StartUniversalTranscodeResponseBody"; } } @@ -138,182 +137,249 @@ export type StartUniversalTranscodeResponse = { }; /** @internal */ +export const StartUniversalTranscodeRequest$inboundSchema: z.ZodType< + StartUniversalTranscodeRequest, + z.ZodTypeDef, + unknown +> = z.object({ + hasMDE: z.number(), + path: z.string(), + mediaIndex: z.number(), + partIndex: z.number(), + protocol: z.string(), + fastSeek: z.number().optional(), + directPlay: z.number().optional(), + directStream: z.number().optional(), + subtitleSize: z.number().optional(), + subtites: z.string().optional(), + audioBoost: z.number().optional(), + location: z.string().optional(), + mediaBufferSize: z.number().optional(), + session: z.string().optional(), + addDebugOverlay: z.number().optional(), + autoAdjustQuality: z.number().optional(), +}); + +/** @internal */ +export type StartUniversalTranscodeRequest$Outbound = { + hasMDE: number; + path: string; + mediaIndex: number; + partIndex: number; + protocol: string; + fastSeek?: number | undefined; + directPlay?: number | undefined; + directStream?: number | undefined; + subtitleSize?: number | undefined; + subtites?: string | undefined; + audioBoost?: number | undefined; + location?: string | undefined; + mediaBufferSize?: number | undefined; + session?: string | undefined; + addDebugOverlay?: number | undefined; + autoAdjustQuality?: number | undefined; +}; + +/** @internal */ +export const StartUniversalTranscodeRequest$outboundSchema: z.ZodType< + StartUniversalTranscodeRequest$Outbound, + z.ZodTypeDef, + StartUniversalTranscodeRequest +> = z.object({ + hasMDE: z.number(), + path: z.string(), + mediaIndex: z.number(), + partIndex: z.number(), + protocol: z.string(), + fastSeek: z.number().optional(), + directPlay: z.number().optional(), + directStream: z.number().optional(), + subtitleSize: z.number().optional(), + subtites: z.string().optional(), + audioBoost: z.number().optional(), + location: z.string().optional(), + mediaBufferSize: z.number().optional(), + session: z.string().optional(), + addDebugOverlay: z.number().optional(), + autoAdjustQuality: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartUniversalTranscodeRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - hasMDE: z.number(), - path: z.string(), - mediaIndex: z.number(), - partIndex: z.number(), - protocol: z.string(), - fastSeek: z.number().optional(), - directPlay: z.number().optional(), - directStream: z.number().optional(), - subtitleSize: z.number().optional(), - subtites: z.string().optional(), - audioBoost: z.number().optional(), - location: z.string().optional(), - mediaBufferSize: z.number().optional(), - session: z.string().optional(), - addDebugOverlay: z.number().optional(), - autoAdjustQuality: z.number().optional(), - }); - - export type Outbound = { - hasMDE: number; - path: string; - mediaIndex: number; - partIndex: number; - protocol: string; - fastSeek?: number | undefined; - directPlay?: number | undefined; - directStream?: number | undefined; - subtitleSize?: number | undefined; - subtites?: string | undefined; - audioBoost?: number | undefined; - location?: string | undefined; - mediaBufferSize?: number | undefined; - session?: string | undefined; - addDebugOverlay?: number | undefined; - autoAdjustQuality?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - hasMDE: z.number(), - path: z.string(), - mediaIndex: z.number(), - partIndex: z.number(), - protocol: z.string(), - fastSeek: z.number().optional(), - directPlay: z.number().optional(), - directStream: z.number().optional(), - subtitleSize: z.number().optional(), - subtites: z.string().optional(), - audioBoost: z.number().optional(), - location: z.string().optional(), - mediaBufferSize: z.number().optional(), - session: z.string().optional(), - addDebugOverlay: z.number().optional(), - autoAdjustQuality: z.number().optional(), - }); + /** @deprecated use `StartUniversalTranscodeRequest$inboundSchema` instead. */ + export const inboundSchema = StartUniversalTranscodeRequest$inboundSchema; + /** @deprecated use `StartUniversalTranscodeRequest$outboundSchema` instead. */ + export const outboundSchema = StartUniversalTranscodeRequest$outboundSchema; + /** @deprecated use `StartUniversalTranscodeRequest$Outbound` instead. */ + export type Outbound = StartUniversalTranscodeRequest$Outbound; } /** @internal */ +export const StartUniversalTranscodeErrors$inboundSchema: z.ZodType< + StartUniversalTranscodeErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type StartUniversalTranscodeErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const StartUniversalTranscodeErrors$outboundSchema: z.ZodType< + StartUniversalTranscodeErrors$Outbound, + z.ZodTypeDef, + StartUniversalTranscodeErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StartUniversalTranscodeErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `StartUniversalTranscodeErrors$inboundSchema` instead. */ + export const inboundSchema = StartUniversalTranscodeErrors$inboundSchema; + /** @deprecated use `StartUniversalTranscodeErrors$outboundSchema` instead. */ + export const outboundSchema = StartUniversalTranscodeErrors$outboundSchema; + /** @deprecated use `StartUniversalTranscodeErrors$Outbound` instead. */ + export type Outbound = StartUniversalTranscodeErrors$Outbound; } /** @internal */ -export namespace StartUniversalTranscodeResponseBody$ { - export const inboundSchema: z.ZodType< - StartUniversalTranscodeResponseBody, - z.ZodTypeDef, - unknown - > = z - .object({ - errors: z.array(z.lazy(() => StartUniversalTranscodeErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new StartUniversalTranscodeResponseBody(remapped); +export const StartUniversalTranscodeResponseBody$inboundSchema: z.ZodType< + StartUniversalTranscodeResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => StartUniversalTranscodeErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - StartUniversalTranscodeResponseBody - > = z - .instanceof(StartUniversalTranscodeResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => StartUniversalTranscodeErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); -} + return new StartUniversalTranscodeResponseBody(remapped); + }); /** @internal */ -export namespace StartUniversalTranscodeResponse$ { - export const inboundSchema: z.ZodType = +export type StartUniversalTranscodeResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const StartUniversalTranscodeResponseBody$outboundSchema: z.ZodType< + StartUniversalTranscodeResponseBody$Outbound, + z.ZodTypeDef, + StartUniversalTranscodeResponseBody +> = z + .instanceof(StartUniversalTranscodeResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), + errors: z + .array(z.lazy(() => StartUniversalTranscodeErrors$outboundSchema)) + .optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", + rawResponse: "RawResponse", }); - }); + }) + ); - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - StartUniversalTranscodeResponse - > = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StartUniversalTranscodeResponseBody$ { + /** @deprecated use `StartUniversalTranscodeResponseBody$inboundSchema` instead. */ + export const inboundSchema = StartUniversalTranscodeResponseBody$inboundSchema; + /** @deprecated use `StartUniversalTranscodeResponseBody$outboundSchema` instead. */ + export const outboundSchema = StartUniversalTranscodeResponseBody$outboundSchema; + /** @deprecated use `StartUniversalTranscodeResponseBody$Outbound` instead. */ + export type Outbound = StartUniversalTranscodeResponseBody$Outbound; +} + +/** @internal */ +export const StartUniversalTranscodeResponse$inboundSchema: z.ZodType< + StartUniversalTranscodeResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type StartUniversalTranscodeResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const StartUniversalTranscodeResponse$outboundSchema: z.ZodType< + StartUniversalTranscodeResponse$Outbound, + z.ZodTypeDef, + StartUniversalTranscodeResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StartUniversalTranscodeResponse$ { + /** @deprecated use `StartUniversalTranscodeResponse$inboundSchema` instead. */ + export const inboundSchema = StartUniversalTranscodeResponse$inboundSchema; + /** @deprecated use `StartUniversalTranscodeResponse$outboundSchema` instead. */ + export const outboundSchema = StartUniversalTranscodeResponse$outboundSchema; + /** @deprecated use `StartUniversalTranscodeResponse$Outbound` instead. */ + export type Outbound = StartUniversalTranscodeResponse$Outbound; } diff --git a/src/models/stopalltasksop.ts b/src/models/stopalltasksop.ts index 679bbbee..ae727e4b 100644 --- a/src/models/stopalltasksop.ts +++ b/src/models/stopalltasksop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -36,7 +36,11 @@ export class StopAllTasksResponseBody extends Error { data$: StopAllTasksResponseBodyData; constructor(err: StopAllTasksResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -46,11 +50,6 @@ export class StopAllTasksResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "StopAllTasksResponseBody"; } } @@ -71,103 +70,166 @@ export type StopAllTasksResponse = { }; /** @internal */ +export const StopAllTasksErrors$inboundSchema: z.ZodType< + StopAllTasksErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type StopAllTasksErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const StopAllTasksErrors$outboundSchema: z.ZodType< + StopAllTasksErrors$Outbound, + z.ZodTypeDef, + StopAllTasksErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopAllTasksErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `StopAllTasksErrors$inboundSchema` instead. */ + export const inboundSchema = StopAllTasksErrors$inboundSchema; + /** @deprecated use `StopAllTasksErrors$outboundSchema` instead. */ + export const outboundSchema = StopAllTasksErrors$outboundSchema; + /** @deprecated use `StopAllTasksErrors$Outbound` instead. */ + export type Outbound = StopAllTasksErrors$Outbound; } /** @internal */ +export const StopAllTasksResponseBody$inboundSchema: z.ZodType< + StopAllTasksResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => StopAllTasksErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new StopAllTasksResponseBody(remapped); + }); + +/** @internal */ +export type StopAllTasksResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const StopAllTasksResponseBody$outboundSchema: z.ZodType< + StopAllTasksResponseBody$Outbound, + z.ZodTypeDef, + StopAllTasksResponseBody +> = z + .instanceof(StopAllTasksResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => StopAllTasksErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopAllTasksResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => StopAllTasksErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new StopAllTasksResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(StopAllTasksResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => StopAllTasksErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `StopAllTasksResponseBody$inboundSchema` instead. */ + export const inboundSchema = StopAllTasksResponseBody$inboundSchema; + /** @deprecated use `StopAllTasksResponseBody$outboundSchema` instead. */ + export const outboundSchema = StopAllTasksResponseBody$outboundSchema; + /** @deprecated use `StopAllTasksResponseBody$Outbound` instead. */ + export type Outbound = StopAllTasksResponseBody$Outbound; } /** @internal */ +export const StopAllTasksResponse$inboundSchema: z.ZodType< + StopAllTasksResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type StopAllTasksResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const StopAllTasksResponse$outboundSchema: z.ZodType< + StopAllTasksResponse$Outbound, + z.ZodTypeDef, + StopAllTasksResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopAllTasksResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `StopAllTasksResponse$inboundSchema` instead. */ + export const inboundSchema = StopAllTasksResponse$inboundSchema; + /** @deprecated use `StopAllTasksResponse$outboundSchema` instead. */ + export const outboundSchema = StopAllTasksResponse$outboundSchema; + /** @deprecated use `StopAllTasksResponse$Outbound` instead. */ + export type Outbound = StopAllTasksResponse$Outbound; } diff --git a/src/models/stoptaskop.ts b/src/models/stoptaskop.ts index 086d6ad3..93910628 100644 --- a/src/models/stoptaskop.ts +++ b/src/models/stoptaskop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -63,7 +63,11 @@ export class StopTaskResponseBody extends Error { data$: StopTaskResponseBodyData; constructor(err: StopTaskResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -73,11 +77,6 @@ export class StopTaskResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "StopTaskResponseBody"; } } @@ -98,125 +97,211 @@ export type StopTaskResponse = { }; /** @internal */ +export const PathParamTaskName$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(PathParamTaskName); + +/** @internal */ +export const PathParamTaskName$outboundSchema: z.ZodNativeEnum = + PathParamTaskName$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace PathParamTaskName$ { - export const inboundSchema: z.ZodNativeEnum = - z.nativeEnum(PathParamTaskName); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `PathParamTaskName$inboundSchema` instead. */ + export const inboundSchema = PathParamTaskName$inboundSchema; + /** @deprecated use `PathParamTaskName$outboundSchema` instead. */ + export const outboundSchema = PathParamTaskName$outboundSchema; } /** @internal */ +export const StopTaskRequest$inboundSchema: z.ZodType = + z.object({ + taskName: PathParamTaskName$inboundSchema, + }); + +/** @internal */ +export type StopTaskRequest$Outbound = { + taskName: string; +}; + +/** @internal */ +export const StopTaskRequest$outboundSchema: z.ZodType< + StopTaskRequest$Outbound, + z.ZodTypeDef, + StopTaskRequest +> = z.object({ + taskName: PathParamTaskName$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTaskRequest$ { - export const inboundSchema: z.ZodType = z.object({ - taskName: PathParamTaskName$.inboundSchema, - }); - - export type Outbound = { - taskName: string; - }; - - export const outboundSchema: z.ZodType = z.object({ - taskName: PathParamTaskName$.outboundSchema, - }); + /** @deprecated use `StopTaskRequest$inboundSchema` instead. */ + export const inboundSchema = StopTaskRequest$inboundSchema; + /** @deprecated use `StopTaskRequest$outboundSchema` instead. */ + export const outboundSchema = StopTaskRequest$outboundSchema; + /** @deprecated use `StopTaskRequest$Outbound` instead. */ + export type Outbound = StopTaskRequest$Outbound; } /** @internal */ +export const StopTaskErrors$inboundSchema: z.ZodType = + z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), + }); + +/** @internal */ +export type StopTaskErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const StopTaskErrors$outboundSchema: z.ZodType< + StopTaskErrors$Outbound, + z.ZodTypeDef, + StopTaskErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTaskErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `StopTaskErrors$inboundSchema` instead. */ + export const inboundSchema = StopTaskErrors$inboundSchema; + /** @deprecated use `StopTaskErrors$outboundSchema` instead. */ + export const outboundSchema = StopTaskErrors$outboundSchema; + /** @deprecated use `StopTaskErrors$Outbound` instead. */ + export type Outbound = StopTaskErrors$Outbound; } /** @internal */ +export const StopTaskResponseBody$inboundSchema: z.ZodType< + StopTaskResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => StopTaskErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new StopTaskResponseBody(remapped); + }); + +/** @internal */ +export type StopTaskResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const StopTaskResponseBody$outboundSchema: z.ZodType< + StopTaskResponseBody$Outbound, + z.ZodTypeDef, + StopTaskResponseBody +> = z + .instanceof(StopTaskResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => StopTaskErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTaskResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => StopTaskErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new StopTaskResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(StopTaskResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => StopTaskErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `StopTaskResponseBody$inboundSchema` instead. */ + export const inboundSchema = StopTaskResponseBody$inboundSchema; + /** @deprecated use `StopTaskResponseBody$outboundSchema` instead. */ + export const outboundSchema = StopTaskResponseBody$outboundSchema; + /** @deprecated use `StopTaskResponseBody$Outbound` instead. */ + export type Outbound = StopTaskResponseBody$Outbound; } /** @internal */ +export const StopTaskResponse$inboundSchema: z.ZodType = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type StopTaskResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const StopTaskResponse$outboundSchema: z.ZodType< + StopTaskResponse$Outbound, + z.ZodTypeDef, + StopTaskResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTaskResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `StopTaskResponse$inboundSchema` instead. */ + export const inboundSchema = StopTaskResponse$inboundSchema; + /** @deprecated use `StopTaskResponse$outboundSchema` instead. */ + export const outboundSchema = StopTaskResponse$outboundSchema; + /** @deprecated use `StopTaskResponse$Outbound` instead. */ + export type Outbound = StopTaskResponse$Outbound; } diff --git a/src/models/stoptranscodesessionop.ts b/src/models/stoptranscodesessionop.ts index ac28e289..48649d38 100644 --- a/src/models/stoptranscodesessionop.ts +++ b/src/models/stoptranscodesessionop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -43,7 +43,11 @@ export class StopTranscodeSessionResponseBody extends Error { data$: StopTranscodeSessionResponseBodyData; constructor(err: StopTranscodeSessionResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -53,11 +57,6 @@ export class StopTranscodeSessionResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "StopTranscodeSessionResponseBody"; } } @@ -78,129 +77,202 @@ export type StopTranscodeSessionResponse = { }; /** @internal */ +export const StopTranscodeSessionRequest$inboundSchema: z.ZodType< + StopTranscodeSessionRequest, + z.ZodTypeDef, + unknown +> = z.object({ + sessionKey: z.string(), +}); + +/** @internal */ +export type StopTranscodeSessionRequest$Outbound = { + sessionKey: string; +}; + +/** @internal */ +export const StopTranscodeSessionRequest$outboundSchema: z.ZodType< + StopTranscodeSessionRequest$Outbound, + z.ZodTypeDef, + StopTranscodeSessionRequest +> = z.object({ + sessionKey: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTranscodeSessionRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - sessionKey: z.string(), - }); - - export type Outbound = { - sessionKey: string; - }; - - export const outboundSchema: z.ZodType = - z.object({ - sessionKey: z.string(), - }); + /** @deprecated use `StopTranscodeSessionRequest$inboundSchema` instead. */ + export const inboundSchema = StopTranscodeSessionRequest$inboundSchema; + /** @deprecated use `StopTranscodeSessionRequest$outboundSchema` instead. */ + export const outboundSchema = StopTranscodeSessionRequest$outboundSchema; + /** @deprecated use `StopTranscodeSessionRequest$Outbound` instead. */ + export type Outbound = StopTranscodeSessionRequest$Outbound; } /** @internal */ +export const StopTranscodeSessionErrors$inboundSchema: z.ZodType< + StopTranscodeSessionErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type StopTranscodeSessionErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const StopTranscodeSessionErrors$outboundSchema: z.ZodType< + StopTranscodeSessionErrors$Outbound, + z.ZodTypeDef, + StopTranscodeSessionErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTranscodeSessionErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `StopTranscodeSessionErrors$inboundSchema` instead. */ + export const inboundSchema = StopTranscodeSessionErrors$inboundSchema; + /** @deprecated use `StopTranscodeSessionErrors$outboundSchema` instead. */ + export const outboundSchema = StopTranscodeSessionErrors$outboundSchema; + /** @deprecated use `StopTranscodeSessionErrors$Outbound` instead. */ + export type Outbound = StopTranscodeSessionErrors$Outbound; } /** @internal */ -export namespace StopTranscodeSessionResponseBody$ { - export const inboundSchema: z.ZodType = +export const StopTranscodeSessionResponseBody$inboundSchema: z.ZodType< + StopTranscodeSessionResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => StopTranscodeSessionErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new StopTranscodeSessionResponseBody(remapped); + }); + +/** @internal */ +export type StopTranscodeSessionResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const StopTranscodeSessionResponseBody$outboundSchema: z.ZodType< + StopTranscodeSessionResponseBody$Outbound, + z.ZodTypeDef, + StopTranscodeSessionResponseBody +> = z + .instanceof(StopTranscodeSessionResponseBody) + .transform((v) => v.data$) + .pipe( z .object({ - errors: z.array(z.lazy(() => StopTranscodeSessionErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), + errors: z.array(z.lazy(() => StopTranscodeSessionErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), }) .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", + return remap$(v, { + rawResponse: "RawResponse", }); + }) + ); - return new StopTranscodeSessionResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType< - Outbound, - z.ZodTypeDef, - StopTranscodeSessionResponseBody - > = z - .instanceof(StopTranscodeSessionResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => StopTranscodeSessionErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StopTranscodeSessionResponseBody$ { + /** @deprecated use `StopTranscodeSessionResponseBody$inboundSchema` instead. */ + export const inboundSchema = StopTranscodeSessionResponseBody$inboundSchema; + /** @deprecated use `StopTranscodeSessionResponseBody$outboundSchema` instead. */ + export const outboundSchema = StopTranscodeSessionResponseBody$outboundSchema; + /** @deprecated use `StopTranscodeSessionResponseBody$Outbound` instead. */ + export type Outbound = StopTranscodeSessionResponseBody$Outbound; } /** @internal */ +export const StopTranscodeSessionResponse$inboundSchema: z.ZodType< + StopTranscodeSessionResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type StopTranscodeSessionResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const StopTranscodeSessionResponse$outboundSchema: z.ZodType< + StopTranscodeSessionResponse$Outbound, + z.ZodTypeDef, + StopTranscodeSessionResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace StopTranscodeSessionResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `StopTranscodeSessionResponse$inboundSchema` instead. */ + export const inboundSchema = StopTranscodeSessionResponse$inboundSchema; + /** @deprecated use `StopTranscodeSessionResponse$outboundSchema` instead. */ + export const outboundSchema = StopTranscodeSessionResponse$outboundSchema; + /** @deprecated use `StopTranscodeSessionResponse$Outbound` instead. */ + export type Outbound = StopTranscodeSessionResponse$Outbound; } diff --git a/src/models/updateplaylistop.ts b/src/models/updateplaylistop.ts index dc4fe184..c0588d5b 100644 --- a/src/models/updateplaylistop.ts +++ b/src/models/updateplaylistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -51,7 +51,11 @@ export class UpdatePlaylistResponseBody extends Error { data$: UpdatePlaylistResponseBodyData; constructor(err: UpdatePlaylistResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -61,11 +65,6 @@ export class UpdatePlaylistResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "UpdatePlaylistResponseBody"; } } @@ -86,127 +85,208 @@ export type UpdatePlaylistResponse = { }; /** @internal */ +export const UpdatePlaylistRequest$inboundSchema: z.ZodType< + UpdatePlaylistRequest, + z.ZodTypeDef, + unknown +> = z.object({ + playlistID: z.number(), + title: z.string().optional(), + summary: z.string().optional(), +}); + +/** @internal */ +export type UpdatePlaylistRequest$Outbound = { + playlistID: number; + title?: string | undefined; + summary?: string | undefined; +}; + +/** @internal */ +export const UpdatePlaylistRequest$outboundSchema: z.ZodType< + UpdatePlaylistRequest$Outbound, + z.ZodTypeDef, + UpdatePlaylistRequest +> = z.object({ + playlistID: z.number(), + title: z.string().optional(), + summary: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlaylistRequest$ { - export const inboundSchema: z.ZodType = z.object({ - playlistID: z.number(), - title: z.string().optional(), - summary: z.string().optional(), - }); - - export type Outbound = { - playlistID: number; - title?: string | undefined; - summary?: string | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - playlistID: z.number(), - title: z.string().optional(), - summary: z.string().optional(), - }); + /** @deprecated use `UpdatePlaylistRequest$inboundSchema` instead. */ + export const inboundSchema = UpdatePlaylistRequest$inboundSchema; + /** @deprecated use `UpdatePlaylistRequest$outboundSchema` instead. */ + export const outboundSchema = UpdatePlaylistRequest$outboundSchema; + /** @deprecated use `UpdatePlaylistRequest$Outbound` instead. */ + export type Outbound = UpdatePlaylistRequest$Outbound; } /** @internal */ +export const UpdatePlaylistErrors$inboundSchema: z.ZodType< + UpdatePlaylistErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type UpdatePlaylistErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const UpdatePlaylistErrors$outboundSchema: z.ZodType< + UpdatePlaylistErrors$Outbound, + z.ZodTypeDef, + UpdatePlaylistErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlaylistErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `UpdatePlaylistErrors$inboundSchema` instead. */ + export const inboundSchema = UpdatePlaylistErrors$inboundSchema; + /** @deprecated use `UpdatePlaylistErrors$outboundSchema` instead. */ + export const outboundSchema = UpdatePlaylistErrors$outboundSchema; + /** @deprecated use `UpdatePlaylistErrors$Outbound` instead. */ + export type Outbound = UpdatePlaylistErrors$Outbound; +} + +/** @internal */ +export const UpdatePlaylistResponseBody$inboundSchema: z.ZodType< + UpdatePlaylistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => UpdatePlaylistErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new UpdatePlaylistResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; +/** @internal */ +export type UpdatePlaylistResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } +/** @internal */ +export const UpdatePlaylistResponseBody$outboundSchema: z.ZodType< + UpdatePlaylistResponseBody$Outbound, + z.ZodTypeDef, + UpdatePlaylistResponseBody +> = z + .instanceof(UpdatePlaylistResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => UpdatePlaylistErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); -} -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlaylistResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => UpdatePlaylistErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new UpdatePlaylistResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(UpdatePlaylistResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => UpdatePlaylistErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `UpdatePlaylistResponseBody$inboundSchema` instead. */ + export const inboundSchema = UpdatePlaylistResponseBody$inboundSchema; + /** @deprecated use `UpdatePlaylistResponseBody$outboundSchema` instead. */ + export const outboundSchema = UpdatePlaylistResponseBody$outboundSchema; + /** @deprecated use `UpdatePlaylistResponseBody$Outbound` instead. */ + export type Outbound = UpdatePlaylistResponseBody$Outbound; } /** @internal */ +export const UpdatePlaylistResponse$inboundSchema: z.ZodType< + UpdatePlaylistResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type UpdatePlaylistResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const UpdatePlaylistResponse$outboundSchema: z.ZodType< + UpdatePlaylistResponse$Outbound, + z.ZodTypeDef, + UpdatePlaylistResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlaylistResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `UpdatePlaylistResponse$inboundSchema` instead. */ + export const inboundSchema = UpdatePlaylistResponse$inboundSchema; + /** @deprecated use `UpdatePlaylistResponse$outboundSchema` instead. */ + export const outboundSchema = UpdatePlaylistResponse$outboundSchema; + /** @deprecated use `UpdatePlaylistResponse$Outbound` instead. */ + export type Outbound = UpdatePlaylistResponse$Outbound; } diff --git a/src/models/updateplayprogressop.ts b/src/models/updateplayprogressop.ts index 01534893..9ad8fedf 100644 --- a/src/models/updateplayprogressop.ts +++ b/src/models/updateplayprogressop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -51,7 +51,11 @@ export class UpdatePlayProgressResponseBody extends Error { data$: UpdatePlayProgressResponseBodyData; constructor(err: UpdatePlayProgressResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -61,11 +65,6 @@ export class UpdatePlayProgressResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "UpdatePlayProgressResponseBody"; } } @@ -86,131 +85,208 @@ export type UpdatePlayProgressResponse = { }; /** @internal */ +export const UpdatePlayProgressRequest$inboundSchema: z.ZodType< + UpdatePlayProgressRequest, + z.ZodTypeDef, + unknown +> = z.object({ + key: z.string(), + time: z.number(), + state: z.string(), +}); + +/** @internal */ +export type UpdatePlayProgressRequest$Outbound = { + key: string; + time: number; + state: string; +}; + +/** @internal */ +export const UpdatePlayProgressRequest$outboundSchema: z.ZodType< + UpdatePlayProgressRequest$Outbound, + z.ZodTypeDef, + UpdatePlayProgressRequest +> = z.object({ + key: z.string(), + time: z.number(), + state: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlayProgressRequest$ { - export const inboundSchema: z.ZodType = - z.object({ - key: z.string(), - time: z.number(), - state: z.string(), - }); - - export type Outbound = { - key: string; - time: number; - state: string; - }; - - export const outboundSchema: z.ZodType = - z.object({ - key: z.string(), - time: z.number(), - state: z.string(), - }); + /** @deprecated use `UpdatePlayProgressRequest$inboundSchema` instead. */ + export const inboundSchema = UpdatePlayProgressRequest$inboundSchema; + /** @deprecated use `UpdatePlayProgressRequest$outboundSchema` instead. */ + export const outboundSchema = UpdatePlayProgressRequest$outboundSchema; + /** @deprecated use `UpdatePlayProgressRequest$Outbound` instead. */ + export type Outbound = UpdatePlayProgressRequest$Outbound; } /** @internal */ +export const UpdatePlayProgressErrors$inboundSchema: z.ZodType< + UpdatePlayProgressErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type UpdatePlayProgressErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const UpdatePlayProgressErrors$outboundSchema: z.ZodType< + UpdatePlayProgressErrors$Outbound, + z.ZodTypeDef, + UpdatePlayProgressErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlayProgressErrors$ { - export const inboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); - - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; - - export const outboundSchema: z.ZodType = - z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - }); + /** @deprecated use `UpdatePlayProgressErrors$inboundSchema` instead. */ + export const inboundSchema = UpdatePlayProgressErrors$inboundSchema; + /** @deprecated use `UpdatePlayProgressErrors$outboundSchema` instead. */ + export const outboundSchema = UpdatePlayProgressErrors$outboundSchema; + /** @deprecated use `UpdatePlayProgressErrors$Outbound` instead. */ + export type Outbound = UpdatePlayProgressErrors$Outbound; } /** @internal */ -export namespace UpdatePlayProgressResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => UpdatePlayProgressErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new UpdatePlayProgressResponseBody(remapped); +export const UpdatePlayProgressResponseBody$inboundSchema: z.ZodType< + UpdatePlayProgressResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => UpdatePlayProgressErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", }); - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; + return new UpdatePlayProgressResponseBody(remapped); + }); - export const outboundSchema: z.ZodType = +/** @internal */ +export type UpdatePlayProgressResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; + +/** @internal */ +export const UpdatePlayProgressResponseBody$outboundSchema: z.ZodType< + UpdatePlayProgressResponseBody$Outbound, + z.ZodTypeDef, + UpdatePlayProgressResponseBody +> = z + .instanceof(UpdatePlayProgressResponseBody) + .transform((v) => v.data$) + .pipe( z - .instanceof(UpdatePlayProgressResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z - .array(z.lazy(() => UpdatePlayProgressErrors$.outboundSchema)) - .optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), + .object({ + errors: z.array(z.lazy(() => UpdatePlayProgressErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) + ); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdatePlayProgressResponseBody$ { + /** @deprecated use `UpdatePlayProgressResponseBody$inboundSchema` instead. */ + export const inboundSchema = UpdatePlayProgressResponseBody$inboundSchema; + /** @deprecated use `UpdatePlayProgressResponseBody$outboundSchema` instead. */ + export const outboundSchema = UpdatePlayProgressResponseBody$outboundSchema; + /** @deprecated use `UpdatePlayProgressResponseBody$Outbound` instead. */ + export type Outbound = UpdatePlayProgressResponseBody$Outbound; } /** @internal */ +export const UpdatePlayProgressResponse$inboundSchema: z.ZodType< + UpdatePlayProgressResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type UpdatePlayProgressResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const UpdatePlayProgressResponse$outboundSchema: z.ZodType< + UpdatePlayProgressResponse$Outbound, + z.ZodTypeDef, + UpdatePlayProgressResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UpdatePlayProgressResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `UpdatePlayProgressResponse$inboundSchema` instead. */ + export const inboundSchema = UpdatePlayProgressResponse$inboundSchema; + /** @deprecated use `UpdatePlayProgressResponse$outboundSchema` instead. */ + export const outboundSchema = UpdatePlayProgressResponse$outboundSchema; + /** @deprecated use `UpdatePlayProgressResponse$Outbound` instead. */ + export type Outbound = UpdatePlayProgressResponse$Outbound; } diff --git a/src/models/uploadplaylistop.ts b/src/models/uploadplaylistop.ts index e329ff43..ed500bc3 100644 --- a/src/models/uploadplaylistop.ts +++ b/src/models/uploadplaylistop.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { remap as remap$ } from "../lib/primitives.js"; @@ -75,7 +75,11 @@ export class UploadPlaylistResponseBody extends Error { data$: UploadPlaylistResponseBodyData; constructor(err: UploadPlaylistResponseBodyData) { - super(""); + const message = + "message" in err && typeof err.message === "string" + ? err.message + : `API error occurred: ${JSON.stringify(err)}`; + super(message); this.data$ = err; if (err.errors != null) { @@ -85,11 +89,6 @@ export class UploadPlaylistResponseBody extends Error { this.rawResponse = err.rawResponse; } - this.message = - "message" in err && typeof err.message === "string" - ? err.message - : "API error occurred"; - this.name = "UploadPlaylistResponseBody"; } } @@ -110,130 +109,222 @@ export type UploadPlaylistResponse = { }; /** @internal */ +export const Force$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Force); + +/** @internal */ +export const Force$outboundSchema: z.ZodNativeEnum = Force$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace Force$ { - export const inboundSchema: z.ZodNativeEnum = z.nativeEnum(Force); - export const outboundSchema: z.ZodNativeEnum = inboundSchema; + /** @deprecated use `Force$inboundSchema` instead. */ + export const inboundSchema = Force$inboundSchema; + /** @deprecated use `Force$outboundSchema` instead. */ + export const outboundSchema = Force$outboundSchema; } /** @internal */ +export const UploadPlaylistRequest$inboundSchema: z.ZodType< + UploadPlaylistRequest, + z.ZodTypeDef, + unknown +> = z.object({ + path: z.string(), + force: Force$inboundSchema, +}); + +/** @internal */ +export type UploadPlaylistRequest$Outbound = { + path: string; + force: number; +}; + +/** @internal */ +export const UploadPlaylistRequest$outboundSchema: z.ZodType< + UploadPlaylistRequest$Outbound, + z.ZodTypeDef, + UploadPlaylistRequest +> = z.object({ + path: z.string(), + force: Force$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UploadPlaylistRequest$ { - export const inboundSchema: z.ZodType = z.object({ - path: z.string(), - force: Force$.inboundSchema, - }); - - export type Outbound = { - path: string; - force: number; - }; - - export const outboundSchema: z.ZodType = - z.object({ - path: z.string(), - force: Force$.outboundSchema, - }); + /** @deprecated use `UploadPlaylistRequest$inboundSchema` instead. */ + export const inboundSchema = UploadPlaylistRequest$inboundSchema; + /** @deprecated use `UploadPlaylistRequest$outboundSchema` instead. */ + export const outboundSchema = UploadPlaylistRequest$outboundSchema; + /** @deprecated use `UploadPlaylistRequest$Outbound` instead. */ + export type Outbound = UploadPlaylistRequest$Outbound; } /** @internal */ +export const UploadPlaylistErrors$inboundSchema: z.ZodType< + UploadPlaylistErrors, + z.ZodTypeDef, + unknown +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** @internal */ +export type UploadPlaylistErrors$Outbound = { + code?: number | undefined; + message?: string | undefined; + status?: number | undefined; +}; + +/** @internal */ +export const UploadPlaylistErrors$outboundSchema: z.ZodType< + UploadPlaylistErrors$Outbound, + z.ZodTypeDef, + UploadPlaylistErrors +> = z.object({ + code: z.number().optional(), + message: z.string().optional(), + status: z.number().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UploadPlaylistErrors$ { - export const inboundSchema: z.ZodType = z.object({ - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), + /** @deprecated use `UploadPlaylistErrors$inboundSchema` instead. */ + export const inboundSchema = UploadPlaylistErrors$inboundSchema; + /** @deprecated use `UploadPlaylistErrors$outboundSchema` instead. */ + export const outboundSchema = UploadPlaylistErrors$outboundSchema; + /** @deprecated use `UploadPlaylistErrors$Outbound` instead. */ + export type Outbound = UploadPlaylistErrors$Outbound; +} + +/** @internal */ +export const UploadPlaylistResponseBody$inboundSchema: z.ZodType< + UploadPlaylistResponseBody, + z.ZodTypeDef, + unknown +> = z + .object({ + errors: z.array(z.lazy(() => UploadPlaylistErrors$inboundSchema)).optional(), + RawResponse: z.instanceof(Response).optional(), + }) + .transform((v) => { + const remapped = remap$(v, { + RawResponse: "rawResponse", + }); + + return new UploadPlaylistResponseBody(remapped); }); - export type Outbound = { - code?: number | undefined; - message?: string | undefined; - status?: number | undefined; - }; +/** @internal */ +export type UploadPlaylistResponseBody$Outbound = { + errors?: Array | undefined; + RawResponse?: never | undefined; +}; - export const outboundSchema: z.ZodType = z.object( - { - code: z.number().optional(), - message: z.string().optional(), - status: z.number().optional(), - } +/** @internal */ +export const UploadPlaylistResponseBody$outboundSchema: z.ZodType< + UploadPlaylistResponseBody$Outbound, + z.ZodTypeDef, + UploadPlaylistResponseBody +> = z + .instanceof(UploadPlaylistResponseBody) + .transform((v) => v.data$) + .pipe( + z + .object({ + errors: z.array(z.lazy(() => UploadPlaylistErrors$outboundSchema)).optional(), + rawResponse: z + .instanceof(Response) + .transform(() => { + throw new Error("Response cannot be serialized"); + }) + .optional(), + }) + .transform((v) => { + return remap$(v, { + rawResponse: "RawResponse", + }); + }) ); -} -/** @internal */ +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UploadPlaylistResponseBody$ { - export const inboundSchema: z.ZodType = z - .object({ - errors: z.array(z.lazy(() => UploadPlaylistErrors$.inboundSchema)).optional(), - RawResponse: z.instanceof(Response).optional(), - }) - .transform((v) => { - const remapped = remap$(v, { - RawResponse: "rawResponse", - }); - - return new UploadPlaylistResponseBody(remapped); - }); - - export type Outbound = { - errors?: Array | undefined; - RawResponse?: never | undefined; - }; - - export const outboundSchema: z.ZodType = z - .instanceof(UploadPlaylistResponseBody) - .transform((v) => v.data$) - .pipe( - z - .object({ - errors: z.array(z.lazy(() => UploadPlaylistErrors$.outboundSchema)).optional(), - rawResponse: z - .instanceof(Response) - .transform(() => { - throw new Error("Response cannot be serialized"); - }) - .optional(), - }) - .transform((v) => { - return remap$(v, { - rawResponse: "RawResponse", - }); - }) - ); + /** @deprecated use `UploadPlaylistResponseBody$inboundSchema` instead. */ + export const inboundSchema = UploadPlaylistResponseBody$inboundSchema; + /** @deprecated use `UploadPlaylistResponseBody$outboundSchema` instead. */ + export const outboundSchema = UploadPlaylistResponseBody$outboundSchema; + /** @deprecated use `UploadPlaylistResponseBody$Outbound` instead. */ + export type Outbound = UploadPlaylistResponseBody$Outbound; } /** @internal */ +export const UploadPlaylistResponse$inboundSchema: z.ZodType< + UploadPlaylistResponse, + z.ZodTypeDef, + unknown +> = z + .object({ + ContentType: z.string(), + StatusCode: z.number().int(), + RawResponse: z.instanceof(Response), + }) + .transform((v) => { + return remap$(v, { + ContentType: "contentType", + StatusCode: "statusCode", + RawResponse: "rawResponse", + }); + }); + +/** @internal */ +export type UploadPlaylistResponse$Outbound = { + ContentType: string; + StatusCode: number; + RawResponse: never; +}; + +/** @internal */ +export const UploadPlaylistResponse$outboundSchema: z.ZodType< + UploadPlaylistResponse$Outbound, + z.ZodTypeDef, + UploadPlaylistResponse +> = z + .object({ + contentType: z.string(), + statusCode: z.number().int(), + rawResponse: z.instanceof(Response).transform(() => { + throw new Error("Response cannot be serialized"); + }), + }) + .transform((v) => { + return remap$(v, { + contentType: "ContentType", + statusCode: "StatusCode", + rawResponse: "RawResponse", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ export namespace UploadPlaylistResponse$ { - export const inboundSchema: z.ZodType = z - .object({ - ContentType: z.string(), - StatusCode: z.number().int(), - RawResponse: z.instanceof(Response), - }) - .transform((v) => { - return remap$(v, { - ContentType: "contentType", - StatusCode: "statusCode", - RawResponse: "rawResponse", - }); - }); - - export type Outbound = { - ContentType: string; - StatusCode: number; - RawResponse: never; - }; - - export const outboundSchema: z.ZodType = z - .object({ - contentType: z.string(), - statusCode: z.number().int(), - rawResponse: z.instanceof(Response).transform(() => { - throw new Error("Response cannot be serialized"); - }), - }) - .transform((v) => { - return remap$(v, { - contentType: "ContentType", - statusCode: "StatusCode", - rawResponse: "RawResponse", - }); - }); + /** @deprecated use `UploadPlaylistResponse$inboundSchema` instead. */ + export const inboundSchema = UploadPlaylistResponse$inboundSchema; + /** @deprecated use `UploadPlaylistResponse$outboundSchema` instead. */ + export const outboundSchema = UploadPlaylistResponse$outboundSchema; + /** @deprecated use `UploadPlaylistResponse$Outbound` instead. */ + export type Outbound = UploadPlaylistResponse$Outbound; } diff --git a/src/sdk/activities.ts b/src/sdk/activities.ts index ea411d32..9d8e499e 100644 --- a/src/sdk/activities.ts +++ b/src/sdk/activities.ts @@ -1,42 +1,14 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { activitiesCancelServerActivities } from "../funcs/activitiesCancelServerActivities.js"; +import { activitiesGetServerActivities } from "../funcs/activitiesGetServerActivities.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Activities extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Server Activities * @@ -46,58 +18,7 @@ export class Activities extends ClientSDK { async getServerActivities( options?: RequestOptions ): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/activities")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getServerActivities", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetServerActivitiesResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetServerActivitiesActivitiesResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(activitiesGetServerActivities(this, options)); } /** @@ -110,74 +31,6 @@ export class Activities extends ClientSDK { activityUUID: string, options?: RequestOptions ): Promise { - const input$: models.CancelServerActivitiesRequest = { - activityUUID: activityUUID, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.CancelServerActivitiesRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - activityUUID: encodeSimple$("activityUUID", payload$.activityUUID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/activities/{activityUUID}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "cancelServerActivities", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.CancelServerActivitiesResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.CancelServerActivitiesResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(activitiesCancelServerActivities(this, activityUUID, options)); } } diff --git a/src/sdk/authentication.ts b/src/sdk/authentication.ts index cb63c3bb..db471891 100644 --- a/src/sdk/authentication.ts +++ b/src/sdk/authentication.ts @@ -1,42 +1,14 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { authenticationGetSourceConnectionInformation } from "../funcs/authenticationGetSourceConnectionInformation.js"; +import { authenticationGetTransientToken } from "../funcs/authenticationGetTransientToken.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Authentication extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get a Transient Token. * @@ -49,73 +21,7 @@ export class Authentication extends ClientSDK { scope: models.Scope, options?: RequestOptions ): Promise { - const input$: models.GetTransientTokenRequest = { - type: type, - scope: scope, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetTransientTokenRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/security/token")(); - - const query$ = encodeFormQuery$({ - scope: payload$.scope, - type: payload$.type, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getTransientToken", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.GetTransientTokenResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetTransientTokenResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(authenticationGetTransientToken(this, type, scope, options)); } /** @@ -130,70 +36,6 @@ export class Authentication extends ClientSDK { source: string, options?: RequestOptions ): Promise { - const input$: models.GetSourceConnectionInformationRequest = { - source: source, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetSourceConnectionInformationRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/security/resources")(); - - const query$ = encodeFormQuery$({ - source: payload$.source, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getSourceConnectionInformation", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.GetSourceConnectionInformationResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetSourceConnectionInformationResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(authenticationGetSourceConnectionInformation(this, source, options)); } } diff --git a/src/sdk/butler.ts b/src/sdk/butler.ts index 206b6737..6a5b2cbf 100644 --- a/src/sdk/butler.ts +++ b/src/sdk/butler.ts @@ -1,42 +1,17 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { butlerGetButlerTasks } from "../funcs/butlerGetButlerTasks.js"; +import { butlerStartAllTasks } from "../funcs/butlerStartAllTasks.js"; +import { butlerStartTask } from "../funcs/butlerStartTask.js"; +import { butlerStopAllTasks } from "../funcs/butlerStopAllTasks.js"; +import { butlerStopTask } from "../funcs/butlerStopTask.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Butler extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Butler tasks * @@ -44,58 +19,7 @@ export class Butler extends ClientSDK { * Returns a list of butler tasks */ async getButlerTasks(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/butler")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getButlerTasks", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetButlerTasksResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetButlerTasksButlerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(butlerGetButlerTasks(this, options)); } /** @@ -110,58 +34,7 @@ export class Butler extends ClientSDK { * */ async startAllTasks(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/butler")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "startAllTasks", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "POST", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.StartAllTasksResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.StartAllTasksResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(butlerStartAllTasks(this, options)); } /** @@ -172,58 +45,7 @@ export class Butler extends ClientSDK { * */ async stopAllTasks(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/butler")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "stopAllTasks", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.StopAllTasksResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.StopAllTasksResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(butlerStopAllTasks(this, options)); } /** @@ -241,75 +63,7 @@ export class Butler extends ClientSDK { taskName: models.TaskName, options?: RequestOptions ): Promise { - const input$: models.StartTaskRequest = { - taskName: taskName, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.StartTaskRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - taskName: encodeSimple$("taskName", payload$.taskName, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/butler/{taskName}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "startTask", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "POST", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void([200, 202], models.StartTaskResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.StartTaskResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(butlerStartTask(this, taskName, options)); } /** @@ -323,74 +77,6 @@ export class Butler extends ClientSDK { taskName: models.PathParamTaskName, options?: RequestOptions ): Promise { - const input$: models.StopTaskRequest = { - taskName: taskName, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.StopTaskRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - taskName: encodeSimple$("taskName", payload$.taskName, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/butler/{taskName}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "stopTask", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "404", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.StopTaskResponse$) - .fail([400, 404, "4XX", "5XX"]) - .json(401, models.StopTaskResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(butlerStopTask(this, taskName, options)); } } diff --git a/src/sdk/hubs.ts b/src/sdk/hubs.ts index 7f847b16..2417fd2c 100644 --- a/src/sdk/hubs.ts +++ b/src/sdk/hubs.ts @@ -1,45 +1,14 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { - encodeFormQuery as encodeFormQuery$, - encodeSimple as encodeSimple$, -} from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { hubsGetGlobalHubs } from "../funcs/hubsGetGlobalHubs.js"; +import { hubsGetLibraryHubs } from "../funcs/hubsGetLibraryHubs.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Hubs extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Global Hubs * @@ -51,73 +20,7 @@ export class Hubs extends ClientSDK { onlyTransient?: models.OnlyTransient | undefined, options?: RequestOptions ): Promise { - const input$: models.GetGlobalHubsRequest = { - count: count, - onlyTransient: onlyTransient, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetGlobalHubsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/hubs")(); - - const query$ = encodeFormQuery$({ - count: payload$.count, - onlyTransient: payload$.onlyTransient, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getGlobalHubs", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetGlobalHubsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetGlobalHubsHubsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(hubsGetGlobalHubs(this, count, onlyTransient, options)); } /** @@ -133,79 +36,6 @@ export class Hubs extends ClientSDK { onlyTransient?: models.QueryParamOnlyTransient | undefined, options?: RequestOptions ): Promise { - const input$: models.GetLibraryHubsRequest = { - sectionId: sectionId, - count: count, - onlyTransient: onlyTransient, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetLibraryHubsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sectionId: encodeSimple$("sectionId", payload$.sectionId, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/hubs/sections/{sectionId}")(pathParams$); - - const query$ = encodeFormQuery$({ - count: payload$.count, - onlyTransient: payload$.onlyTransient, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getLibraryHubs", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetLibraryHubsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetLibraryHubsHubsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(hubsGetLibraryHubs(this, sectionId, count, onlyTransient, options)); } } diff --git a/src/sdk/index.ts b/src/sdk/index.ts index 34a84fc2..ecac2264 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export * from "./sdk.js"; diff --git a/src/sdk/library.ts b/src/sdk/library.ts index 5ff32db8..a3f540c4 100644 --- a/src/sdk/library.ts +++ b/src/sdk/library.ts @@ -1,45 +1,24 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { - encodeFormQuery as encodeFormQuery$, - encodeSimple as encodeSimple$, -} from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { libraryDeleteLibrary } from "../funcs/libraryDeleteLibrary.js"; +import { libraryGetFileHash } from "../funcs/libraryGetFileHash.js"; +import { libraryGetLibraries } from "../funcs/libraryGetLibraries.js"; +import { libraryGetLibrary } from "../funcs/libraryGetLibrary.js"; +import { libraryGetLibraryItems } from "../funcs/libraryGetLibraryItems.js"; +import { libraryGetMetadata } from "../funcs/libraryGetMetadata.js"; +import { libraryGetMetadataChildren } from "../funcs/libraryGetMetadataChildren.js"; +import { libraryGetOnDeck } from "../funcs/libraryGetOnDeck.js"; +import { libraryGetRecentlyAdded } from "../funcs/libraryGetRecentlyAdded.js"; +import { libraryGetTopWatchedContent } from "../funcs/libraryGetTopWatchedContent.js"; +import { libraryRefreshLibrary } from "../funcs/libraryRefreshLibrary.js"; +import { librarySearchLibrary } from "../funcs/librarySearchLibrary.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Library extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Hash Value * @@ -51,73 +30,7 @@ export class Library extends ClientSDK { type?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetFileHashRequest = { - url: url, - type: type, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetFileHashRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/library/hashes")(); - - const query$ = encodeFormQuery$({ - type: payload$.type, - url: payload$.url, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getFileHash", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.GetFileHashResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetFileHashResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetFileHash(this, url, type, options)); } /** @@ -128,58 +41,7 @@ export class Library extends ClientSDK { * */ async getRecentlyAdded(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/library/recentlyAdded")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getRecentlyAdded", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetRecentlyAddedResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetRecentlyAddedLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetRecentlyAdded(this, options)); } /** @@ -195,58 +57,7 @@ export class Library extends ClientSDK { * */ async getLibraries(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/library/sections")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getLibraries", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetLibrariesResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetLibrariesLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetLibraries(this, options)); } /** @@ -299,78 +110,7 @@ export class Library extends ClientSDK { includeDetails?: models.IncludeDetails | undefined, options?: RequestOptions ): Promise { - const input$: models.GetLibraryRequest = { - sectionId: sectionId, - includeDetails: includeDetails, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetLibraryRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sectionId: encodeSimple$("sectionId", payload$.sectionId, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/sections/{sectionId}")(pathParams$); - - const query$ = encodeFormQuery$({ - includeDetails: payload$.includeDetails, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getLibrary", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetLibraryResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetLibraryLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetLibrary(this, sectionId, includeDetails, options)); } /** @@ -383,75 +123,7 @@ export class Library extends ClientSDK { sectionId: number, options?: RequestOptions ): Promise { - const input$: models.DeleteLibraryRequest = { - sectionId: sectionId, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.DeleteLibraryRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sectionId: encodeSimple$("sectionId", payload$.sectionId, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/sections/{sectionId}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "deleteLibrary", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.DeleteLibraryResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.DeleteLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryDeleteLibrary(this, sectionId, options)); } /** @@ -486,80 +158,7 @@ export class Library extends ClientSDK { includeGuids?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetLibraryItemsRequest = { - sectionId: sectionId, - tag: tag, - includeGuids: includeGuids, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetLibraryItemsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sectionId: encodeSimple$("sectionId", payload$.sectionId, { - explode: false, - charEncoding: "percent", - }), - tag: encodeSimple$("tag", payload$.tag, { explode: false, charEncoding: "percent" }), - }; - const path$ = this.templateURLComponent("/library/sections/{sectionId}/{tag}")(pathParams$); - - const query$ = encodeFormQuery$({ - includeGuids: payload$.includeGuids, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getLibraryItems", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetLibraryItemsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetLibraryItemsLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetLibraryItems(this, sectionId, tag, includeGuids, options)); } /** @@ -573,77 +172,7 @@ export class Library extends ClientSDK { sectionId: number, options?: RequestOptions ): Promise { - const input$: models.RefreshLibraryRequest = { - sectionId: sectionId, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.RefreshLibraryRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sectionId: encodeSimple$("sectionId", payload$.sectionId, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/sections/{sectionId}/refresh")( - pathParams$ - ); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "refreshLibrary", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.RefreshLibraryResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.RefreshLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryRefreshLibrary(this, sectionId, options)); } /** @@ -675,80 +204,7 @@ export class Library extends ClientSDK { type: models.Type, options?: RequestOptions ): Promise { - const input$: models.SearchLibraryRequest = { - sectionId: sectionId, - type: type, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.SearchLibraryRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sectionId: encodeSimple$("sectionId", payload$.sectionId, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/sections/{sectionId}/search")( - pathParams$ - ); - - const query$ = encodeFormQuery$({ - type: payload$.type, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "searchLibrary", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.SearchLibraryResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.SearchLibraryLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(librarySearchLibrary(this, sectionId, type, options)); } /** @@ -762,75 +218,7 @@ export class Library extends ClientSDK { ratingKey: number, options?: RequestOptions ): Promise { - const input$: models.GetMetadataRequest = { - ratingKey: ratingKey, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetMetadataRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - ratingKey: encodeSimple$("ratingKey", payload$.ratingKey, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/metadata/{ratingKey}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getMetadata", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetMetadataResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetMetadataLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetMetadata(this, ratingKey, options)); } /** @@ -845,80 +233,7 @@ export class Library extends ClientSDK { includeElements?: string | undefined, options?: RequestOptions ): Promise { - const input$: models.GetMetadataChildrenRequest = { - ratingKey: ratingKey, - includeElements: includeElements, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetMetadataChildrenRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - ratingKey: encodeSimple$("ratingKey", payload$.ratingKey, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/metadata/{ratingKey}/children")( - pathParams$ - ); - - const query$ = encodeFormQuery$({ - includeElements: payload$.includeElements, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getMetadataChildren", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetMetadataChildrenResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetMetadataChildrenLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetMetadataChildren(this, ratingKey, includeElements, options)); } /** @@ -933,72 +248,7 @@ export class Library extends ClientSDK { includeGuids?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetTopWatchedContentRequest = { - type: type, - includeGuids: includeGuids, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetTopWatchedContentRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/library/all/top")(); - - const query$ = encodeFormQuery$({ - includeGuids: payload$.includeGuids, - type: payload$.type, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getTopWatchedContent", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetTopWatchedContentResponse$, { key: "object" }) - .fail(["4XX", "5XX"]) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetTopWatchedContent(this, type, includeGuids, options)); } /** @@ -1009,57 +259,6 @@ export class Library extends ClientSDK { * */ async getOnDeck(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/library/onDeck")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getOnDeck", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetOnDeckResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetOnDeckLibraryResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(libraryGetOnDeck(this, options)); } } diff --git a/src/sdk/log.ts b/src/sdk/log.ts index 0121dcf5..54c88c04 100644 --- a/src/sdk/log.ts +++ b/src/sdk/log.ts @@ -1,43 +1,15 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { logEnablePaperTrail } from "../funcs/logEnablePaperTrail.js"; +import { logLogLine } from "../funcs/logLogLine.js"; +import { logLogMultiLine } from "../funcs/logLogMultiLine.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; -import * as z from "zod"; +import { unwrapAsync } from "../types/fp.js"; export class Log extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Logging a single line message. * @@ -51,75 +23,7 @@ export class Log extends ClientSDK { source: string, options?: RequestOptions ): Promise { - const input$: models.LogLineRequest = { - level: level, - message: message, - source: source, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.LogLineRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/log")(); - - const query$ = encodeFormQuery$({ - level: payload$.level, - message: payload$.message, - source: payload$.source, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "logLine", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.LogLineResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.LogLineResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(logLogLine(this, level, message, source, options)); } /** @@ -153,68 +57,7 @@ export class Log extends ClientSDK { request: string, options?: RequestOptions ): Promise { - const input$ = request; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Content-Type", "text/plain"); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => z.string().parse(value$), - "Input validation failed" - ); - const body$ = payload$; - - const path$ = this.templateURLComponent("/log")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "logMultiLine", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "POST", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.LogMultiLineResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.LogMultiLineResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(logLogMultiLine(this, request, options)); } /** @@ -225,57 +68,6 @@ export class Log extends ClientSDK { * */ async enablePaperTrail(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/log/networked")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "enablePaperTrail", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "403", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.EnablePaperTrailResponse$) - .fail([400, 403, "4XX", "5XX"]) - .json(401, models.EnablePaperTrailResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(logEnablePaperTrail(this, options)); } } diff --git a/src/sdk/media.ts b/src/sdk/media.ts index 3fe2a3e4..fbc622a1 100644 --- a/src/sdk/media.ts +++ b/src/sdk/media.ts @@ -1,42 +1,15 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { mediaMarkPlayed } from "../funcs/mediaMarkPlayed.js"; +import { mediaMarkUnplayed } from "../funcs/mediaMarkUnplayed.js"; +import { mediaUpdatePlayProgress } from "../funcs/mediaUpdatePlayProgress.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Media extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Mark Media Played * @@ -44,71 +17,7 @@ export class Media extends ClientSDK { * This will mark the provided media key as Played. */ async markPlayed(key: number, options?: RequestOptions): Promise { - const input$: models.MarkPlayedRequest = { - key: key, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.MarkPlayedRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/:/scrobble")(); - - const query$ = encodeFormQuery$({ - key: payload$.key, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "markPlayed", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.MarkPlayedResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.MarkPlayedResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(mediaMarkPlayed(this, key, options)); } /** @@ -121,71 +30,7 @@ export class Media extends ClientSDK { key: number, options?: RequestOptions ): Promise { - const input$: models.MarkUnplayedRequest = { - key: key, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.MarkUnplayedRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/:/unscrobble")(); - - const query$ = encodeFormQuery$({ - key: payload$.key, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "markUnplayed", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.MarkUnplayedResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.MarkUnplayedResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(mediaMarkUnplayed(this, key, options)); } /** @@ -201,74 +46,6 @@ export class Media extends ClientSDK { state: string, options?: RequestOptions ): Promise { - const input$: models.UpdatePlayProgressRequest = { - key: key, - time: time, - state: state, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.UpdatePlayProgressRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/:/progress")(); - - const query$ = encodeFormQuery$({ - key: payload$.key, - state: payload$.state, - time: payload$.time, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "updatePlayProgress", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "POST", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.UpdatePlayProgressResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.UpdatePlayProgressResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(mediaUpdatePlayProgress(this, key, time, state, options)); } } diff --git a/src/sdk/playlists.ts b/src/sdk/playlists.ts index ff682c57..fc24d6ab 100644 --- a/src/sdk/playlists.ts +++ b/src/sdk/playlists.ts @@ -1,45 +1,21 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { - encodeFormQuery as encodeFormQuery$, - encodeSimple as encodeSimple$, -} from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { playlistsAddPlaylistContents } from "../funcs/playlistsAddPlaylistContents.js"; +import { playlistsClearPlaylistContents } from "../funcs/playlistsClearPlaylistContents.js"; +import { playlistsCreatePlaylist } from "../funcs/playlistsCreatePlaylist.js"; +import { playlistsDeletePlaylist } from "../funcs/playlistsDeletePlaylist.js"; +import { playlistsGetPlaylist } from "../funcs/playlistsGetPlaylist.js"; +import { playlistsGetPlaylistContents } from "../funcs/playlistsGetPlaylistContents.js"; +import { playlistsGetPlaylists } from "../funcs/playlistsGetPlaylists.js"; +import { playlistsUpdatePlaylist } from "../funcs/playlistsUpdatePlaylist.js"; +import { playlistsUploadPlaylist } from "../funcs/playlistsUploadPlaylist.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Playlists extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Create a Playlist * @@ -53,73 +29,7 @@ export class Playlists extends ClientSDK { request: models.CreatePlaylistRequest, options?: RequestOptions ): Promise { - const input$ = request; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.CreatePlaylistRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/playlists")(); - - const query$ = encodeFormQuery$({ - playQueueID: payload$.playQueueID, - smart: payload$.smart, - title: payload$.title, - type: payload$.type, - uri: payload$.uri, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "createPlaylist", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "POST", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.CreatePlaylistResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.CreatePlaylistPlaylistsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsCreatePlaylist(this, request, options)); } /** @@ -133,73 +43,7 @@ export class Playlists extends ClientSDK { smart?: models.QueryParamSmart | undefined, options?: RequestOptions ): Promise { - const input$: models.GetPlaylistsRequest = { - playlistType: playlistType, - smart: smart, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetPlaylistsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/playlists")(); - - const query$ = encodeFormQuery$({ - playlistType: payload$.playlistType, - smart: payload$.smart, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getPlaylists", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetPlaylistsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetPlaylistsPlaylistsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsGetPlaylists(this, playlistType, smart, options)); } /** @@ -214,75 +58,7 @@ export class Playlists extends ClientSDK { playlistID: number, options?: RequestOptions ): Promise { - const input$: models.GetPlaylistRequest = { - playlistID: playlistID, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetPlaylistRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - playlistID: encodeSimple$("playlistID", payload$.playlistID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/playlists/{playlistID}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getPlaylist", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetPlaylistResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetPlaylistPlaylistsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsGetPlaylist(this, playlistID, options)); } /** @@ -296,75 +72,7 @@ export class Playlists extends ClientSDK { playlistID: number, options?: RequestOptions ): Promise { - const input$: models.DeletePlaylistRequest = { - playlistID: playlistID, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.DeletePlaylistRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - playlistID: encodeSimple$("playlistID", payload$.playlistID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/playlists/{playlistID}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "deletePlaylist", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(204, models.DeletePlaylistResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.DeletePlaylistResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsDeletePlaylist(this, playlistID, options)); } /** @@ -380,80 +88,7 @@ export class Playlists extends ClientSDK { summary?: string | undefined, options?: RequestOptions ): Promise { - const input$: models.UpdatePlaylistRequest = { - playlistID: playlistID, - title: title, - summary: summary, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.UpdatePlaylistRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - playlistID: encodeSimple$("playlistID", payload$.playlistID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/playlists/{playlistID}")(pathParams$); - - const query$ = encodeFormQuery$({ - summary: payload$.summary, - title: payload$.title, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "updatePlaylist", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "PUT", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.UpdatePlaylistResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.UpdatePlaylistResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsUpdatePlaylist(this, playlistID, title, summary, options)); } /** @@ -471,78 +106,7 @@ export class Playlists extends ClientSDK { type: number, options?: RequestOptions ): Promise { - const input$: models.GetPlaylistContentsRequest = { - playlistID: playlistID, - type: type, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetPlaylistContentsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - playlistID: encodeSimple$("playlistID", payload$.playlistID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/playlists/{playlistID}/items")(pathParams$); - - const query$ = encodeFormQuery$({ - type: payload$.type, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getPlaylistContents", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetPlaylistContentsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetPlaylistContentsPlaylistsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsGetPlaylistContents(this, playlistID, type, options)); } /** @@ -556,75 +120,7 @@ export class Playlists extends ClientSDK { playlistID: number, options?: RequestOptions ): Promise { - const input$: models.ClearPlaylistContentsRequest = { - playlistID: playlistID, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.ClearPlaylistContentsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - playlistID: encodeSimple$("playlistID", payload$.playlistID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/playlists/{playlistID}/items")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "clearPlaylistContents", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.ClearPlaylistContentsResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.ClearPlaylistContentsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsClearPlaylistContents(this, playlistID, options)); } /** @@ -641,80 +137,9 @@ export class Playlists extends ClientSDK { playQueueID?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.AddPlaylistContentsRequest = { - playlistID: playlistID, - uri: uri, - playQueueID: playQueueID, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.AddPlaylistContentsRequest$.outboundSchema.parse(value$), - "Input validation failed" + return unwrapAsync( + playlistsAddPlaylistContents(this, playlistID, uri, playQueueID, options) ); - const body$ = null; - - const pathParams$ = { - playlistID: encodeSimple$("playlistID", payload$.playlistID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/playlists/{playlistID}/items")(pathParams$); - - const query$ = encodeFormQuery$({ - playQueueID: payload$.playQueueID, - uri: payload$.uri, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "addPlaylistContents", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "PUT", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.AddPlaylistContentsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.AddPlaylistContentsPlaylistsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; } /** @@ -729,72 +154,6 @@ export class Playlists extends ClientSDK { force: models.Force, options?: RequestOptions ): Promise { - const input$: models.UploadPlaylistRequest = { - path: path, - force: force, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.UploadPlaylistRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/playlists/upload")(); - - const query$ = encodeFormQuery$({ - force: payload$.force, - path: payload$.path, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "uploadPlaylist", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "POST", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.UploadPlaylistResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.UploadPlaylistResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(playlistsUploadPlaylist(this, path, force, options)); } } diff --git a/src/sdk/plex.ts b/src/sdk/plex.ts index 2fe0f52b..d11fdef3 100644 --- a/src/sdk/plex.ts +++ b/src/sdk/plex.ts @@ -1,45 +1,54 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { - encodeFormQuery as encodeFormQuery$, - encodeSimple as encodeSimple$, -} from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { plexGetCompanionsData } from "../funcs/plexGetCompanionsData.js"; +import { plexGetGeoData } from "../funcs/plexGetGeoData.js"; +import { plexGetHomeData } from "../funcs/plexGetHomeData.js"; +import { plexGetPin } from "../funcs/plexGetPin.js"; +import { plexGetResources } from "../funcs/plexGetResources.js"; +import { plexGetTokenByPinId } from "../funcs/plexGetTokenByPinId.js"; +import { plexGetUserDetails } from "../funcs/plexGetUserDetails.js"; +import { plexGetUserFriends } from "../funcs/plexGetUserFriends.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import { GetPinOpServerList } from "../models/getpinop.js"; -import { GetTokenOpServerList } from "../models/gettokenop.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Plex extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; + /** + * Get Companions Data + * + * @remarks + * Get Companions Data + */ + async getCompanionsData( + options?: RequestOptions & { serverURL?: string } + ): Promise { + return unwrapAsync(plexGetCompanionsData(this, options)); + } - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } + /** + * Get list of friends of the user logged in + * + * @remarks + * Get friends of provided auth token. + */ + async getUserFriends( + options?: RequestOptions & { serverURL?: string } + ): Promise { + return unwrapAsync(plexGetUserFriends(this, options)); + } - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; + /** + * Get Geo Data + * + * @remarks + * Returns the geolocation and locale data of the caller + */ + async getGeoData( + options?: RequestOptions & { serverURL?: string } + ): Promise { + return unwrapAsync(plexGetGeoData(this, options)); } /** @@ -49,58 +58,32 @@ export class Plex extends ClientSDK { * Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status. */ async getHomeData(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); + return unwrapAsync(plexGetHomeData(this, options)); + } - const path$ = this.templateURLComponent("/home")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getHomeData", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options + /** + * Get Resources + * + * @remarks + * Get Resources + */ + async getResources( + xPlexClientIdentifier?: string | undefined, + includeHttps?: models.IncludeHttps | undefined, + includeRelay?: models.IncludeRelay | undefined, + includeIPv6?: models.IncludeIPv6 | undefined, + options?: RequestOptions & { serverURL?: string } + ): Promise { + return unwrapAsync( + plexGetResources( + this, + xPlexClientIdentifier, + includeHttps, + includeRelay, + includeIPv6, + options + ) ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetHomeDataResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetHomeDataPlexResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; } /** @@ -115,158 +98,32 @@ export class Plex extends ClientSDK { xPlexClientIdentifier?: string | undefined, options?: RequestOptions & { serverURL?: string } ): Promise { - const input$: models.GetPinRequest = { - strong: strong, - xPlexClientIdentifier: xPlexClientIdentifier, - xPlexProduct: xPlexProduct, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetPinRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - const baseURL$ = - options?.serverURL || - this.templateURLComponent(GetPinOpServerList[0], { charEncoding: "percent" })(); - - const path$ = this.templateURLComponent("/pins")(); - - const query$ = encodeFormQuery$({ - strong: payload$.strong, - }); - - headers$.set( - "X-Plex-Client-Identifier", - encodeSimple$( - "X-Plex-Client-Identifier", - payload$["X-Plex-Client-Identifier"] ?? this.options$.xPlexClientIdentifier, - { explode: false, charEncoding: "none" } - ) - ); - headers$.set( - "X-Plex-Product", - encodeSimple$("X-Plex-Product", payload$["X-Plex-Product"], { - explode: false, - charEncoding: "none", - }) - ); - const context = { operationID: "getPin", oAuth2Scopes: [], securitySource: null }; - - const doOptions = { context, errorCodes: ["400", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - method: "POST", - baseURL: baseURL$, - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(201, models.GetPinResponse$, { key: "object" }) - .json(400, models.GetPinPlexResponseBody$, { err: true }) - .fail(["4XX", "5XX"]) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(plexGetPin(this, xPlexProduct, strong, xPlexClientIdentifier, options)); } /** - * Get Access Token + * Get Access Token by PinId * * @remarks - * Retrieve an Access Token from Plex.tv after the Pin has already been authenticated + * Retrieve an Access Token from Plex.tv after the Pin has been authenticated */ - async getToken( - pinID: string, + async getTokenByPinId( + pinID: number, xPlexClientIdentifier?: string | undefined, options?: RequestOptions & { serverURL?: string } - ): Promise { - const input$: models.GetTokenRequest = { - pinID: pinID, - xPlexClientIdentifier: xPlexClientIdentifier, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); + ): Promise { + return unwrapAsync(plexGetTokenByPinId(this, pinID, xPlexClientIdentifier, options)); + } - const payload$ = schemas$.parse( - input$, - (value$) => models.GetTokenRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - const baseURL$ = - options?.serverURL || - this.templateURLComponent(GetTokenOpServerList[0], { charEncoding: "percent" })(); - - const pathParams$ = { - pinID: encodeSimple$("pinID", payload$.pinID, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/pins/{pinID}")(pathParams$); - - const query$ = ""; - - headers$.set( - "X-Plex-Client-Identifier", - encodeSimple$( - "X-Plex-Client-Identifier", - payload$["X-Plex-Client-Identifier"] ?? this.options$.xPlexClientIdentifier, - { explode: false, charEncoding: "none" } - ) - ); - const context = { operationID: "getToken", oAuth2Scopes: [], securitySource: null }; - - const doOptions = { context, errorCodes: ["400", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - method: "GET", - baseURL: baseURL$, - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetTokenResponse$, { key: "object" }) - .json(400, models.GetTokenPlexResponseBody$, { err: true }) - .fail(["4XX", "5XX"]) - .match(response, { extraFields: responseFields$ }); - - return result$; + /** + * Get UserData By Token + * + * @remarks + * Get the User data from the provided X-Plex-Token + */ + async getUserDetails( + options?: RequestOptions & { serverURL?: string } + ): Promise { + return unwrapAsync(plexGetUserDetails(this, options)); } } diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 47d89fdc..d0254562 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -1,10 +1,7 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { HTTPClient } from "../lib/http.js"; import { ClientSDK } from "../lib/sdks.js"; import { Activities } from "./activities.js"; import { Authentication } from "./authentication.js"; @@ -20,36 +17,11 @@ import { Server } from "./server.js"; import { Sessions } from "./sessions.js"; import { Statistics } from "./statistics.js"; import { Updater } from "./updater.js"; +import { User } from "./user.js"; import { Video } from "./video.js"; import { Watchlist } from "./watchlist.js"; export class PlexAPI extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - private _server?: Server; get server(): Server { return (this._server ??= new Server(this.options$)); @@ -125,6 +97,11 @@ export class PlexAPI extends ClientSDK { return (this._updater ??= new Updater(this.options$)); } + private _user?: User; + get user(): User { + return (this._user ??= new User(this.options$)); + } + private _watchlist?: Watchlist; get watchlist(): Watchlist { return (this._watchlist ??= new Watchlist(this.options$)); diff --git a/src/sdk/search.ts b/src/sdk/search.ts index ff688524..85b245d5 100644 --- a/src/sdk/search.ts +++ b/src/sdk/search.ts @@ -1,42 +1,15 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { searchGetSearchResults } from "../funcs/searchGetSearchResults.js"; +import { searchPerformSearch } from "../funcs/searchPerformSearch.js"; +import { searchPerformVoiceSearch } from "../funcs/searchPerformVoiceSearch.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Search extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Perform a search * @@ -61,75 +34,7 @@ export class Search extends ClientSDK { limit?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.PerformSearchRequest = { - query: query, - sectionId: sectionId, - limit: limit, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.PerformSearchRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/hubs/search")(); - - const query$ = encodeFormQuery$({ - limit: payload$.limit, - query: payload$.query, - sectionId: payload$.sectionId, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "performSearch", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.PerformSearchResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.PerformSearchResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(searchPerformSearch(this, query, sectionId, limit, options)); } /** @@ -148,75 +53,7 @@ export class Search extends ClientSDK { limit?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.PerformVoiceSearchRequest = { - query: query, - sectionId: sectionId, - limit: limit, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.PerformVoiceSearchRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/hubs/search/voice")(); - - const query$ = encodeFormQuery$({ - limit: payload$.limit, - query: payload$.query, - sectionId: payload$.sectionId, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "performVoiceSearch", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.PerformVoiceSearchResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.PerformVoiceSearchResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(searchPerformVoiceSearch(this, query, sectionId, limit, options)); } /** @@ -229,70 +66,6 @@ export class Search extends ClientSDK { query: string, options?: RequestOptions ): Promise { - const input$: models.GetSearchResultsRequest = { - query: query, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetSearchResultsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/search")(); - - const query$ = encodeFormQuery$({ - query: payload$.query, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getSearchResults", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetSearchResultsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetSearchResultsSearchResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(searchGetSearchResults(this, query, options)); } } diff --git a/src/sdk/server.ts b/src/sdk/server.ts index 53d4aa25..f67d9bdd 100644 --- a/src/sdk/server.ts +++ b/src/sdk/server.ts @@ -1,42 +1,20 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { serverGetAvailableClients } from "../funcs/serverGetAvailableClients.js"; +import { serverGetDevices } from "../funcs/serverGetDevices.js"; +import { serverGetMyPlexAccount } from "../funcs/serverGetMyPlexAccount.js"; +import { serverGetResizedPhoto } from "../funcs/serverGetResizedPhoto.js"; +import { serverGetServerCapabilities } from "../funcs/serverGetServerCapabilities.js"; +import { serverGetServerIdentity } from "../funcs/serverGetServerIdentity.js"; +import { serverGetServerList } from "../funcs/serverGetServerList.js"; +import { serverGetServerPreferences } from "../funcs/serverGetServerPreferences.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Server extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Server Capabilities * @@ -46,58 +24,7 @@ export class Server extends ClientSDK { async getServerCapabilities( options?: RequestOptions ): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getServerCapabilities", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetServerCapabilitiesResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetServerCapabilitiesServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetServerCapabilities(this, options)); } /** @@ -109,58 +36,7 @@ export class Server extends ClientSDK { async getServerPreferences( options?: RequestOptions ): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/:/prefs")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getServerPreferences", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetServerPreferencesResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetServerPreferencesServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetServerPreferences(this, options)); } /** @@ -172,58 +48,7 @@ export class Server extends ClientSDK { async getAvailableClients( options?: RequestOptions ): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/clients")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getAvailableClients", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetAvailableClientsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetAvailableClientsServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetAvailableClients(this, options)); } /** @@ -233,58 +58,7 @@ export class Server extends ClientSDK { * Get Devices */ async getDevices(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/devices")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getDevices", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetDevicesResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetDevicesServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetDevices(this, options)); } /** @@ -294,58 +68,7 @@ export class Server extends ClientSDK { * Get Server Identity */ async getServerIdentity(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/identity")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getServerIdentity", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetServerIdentityResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetServerIdentityServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetServerIdentity(this, options)); } /** @@ -355,58 +78,7 @@ export class Server extends ClientSDK { * Returns MyPlex Account Information */ async getMyPlexAccount(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/myplex/account")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getMyPlexAccount", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetMyPlexAccountResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetMyPlexAccountServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetMyPlexAccount(this, options)); } /** @@ -420,75 +92,7 @@ export class Server extends ClientSDK { request: models.GetResizedPhotoRequest, options?: RequestOptions ): Promise { - const input$ = request; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetResizedPhotoRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/photo/:/transcode")(); - - const query$ = encodeFormQuery$({ - blur: payload$.blur, - height: payload$.height, - minSize: payload$.minSize, - opacity: payload$.opacity, - upscale: payload$.upscale, - url: payload$.url, - width: payload$.width, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getResizedPhoto", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.GetResizedPhotoResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetResizedPhotoResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetResizedPhoto(this, request, options)); } /** @@ -498,57 +102,6 @@ export class Server extends ClientSDK { * Get Server List */ async getServerList(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/servers")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getServerList", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetServerListResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetServerListServerResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(serverGetServerList(this, options)); } } diff --git a/src/sdk/sessions.ts b/src/sdk/sessions.ts index ae8b34cd..059d8021 100644 --- a/src/sdk/sessions.ts +++ b/src/sdk/sessions.ts @@ -1,45 +1,16 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { - encodeFormQuery as encodeFormQuery$, - encodeSimple as encodeSimple$, -} from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { sessionsGetSessionHistory } from "../funcs/sessionsGetSessionHistory.js"; +import { sessionsGetSessions } from "../funcs/sessionsGetSessions.js"; +import { sessionsGetTranscodeSessions } from "../funcs/sessionsGetTranscodeSessions.js"; +import { sessionsStopTranscodeSession } from "../funcs/sessionsStopTranscodeSession.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Sessions extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Active Sessions * @@ -47,58 +18,7 @@ export class Sessions extends ClientSDK { * This will retrieve the "Now Playing" Information of the PMS. */ async getSessions(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/status/sessions")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getSessions", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetSessionsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetSessionsSessionsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(sessionsGetSessions(this, options)); } /** @@ -114,77 +34,9 @@ export class Sessions extends ClientSDK { librarySectionID?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetSessionHistoryRequest = { - sort: sort, - accountId: accountId, - filter: filter, - librarySectionID: librarySectionID, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetSessionHistoryRequest$.outboundSchema.parse(value$), - "Input validation failed" + return unwrapAsync( + sessionsGetSessionHistory(this, sort, accountId, filter, librarySectionID, options) ); - const body$ = null; - - const path$ = this.templateURLComponent("/status/sessions/history/all")(); - - const query$ = encodeFormQuery$({ - accountId: payload$.accountId, - filter: payload$.filter, - librarySectionID: payload$.librarySectionID, - sort: payload$.sort, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getSessionHistory", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetSessionHistoryResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetSessionHistorySessionsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; } /** @@ -196,58 +48,7 @@ export class Sessions extends ClientSDK { async getTranscodeSessions( options?: RequestOptions ): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/transcode/sessions")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getTranscodeSessions", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetTranscodeSessionsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetTranscodeSessionsSessionsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(sessionsGetTranscodeSessions(this, options)); } /** @@ -260,74 +61,6 @@ export class Sessions extends ClientSDK { sessionKey: string, options?: RequestOptions ): Promise { - const input$: models.StopTranscodeSessionRequest = { - sessionKey: sessionKey, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.StopTranscodeSessionRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const pathParams$ = { - sessionKey: encodeSimple$("sessionKey", payload$.sessionKey, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/transcode/sessions/{sessionKey}")(pathParams$); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "stopTranscodeSession", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "DELETE", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(204, models.StopTranscodeSessionResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.StopTranscodeSessionResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(sessionsStopTranscodeSession(this, sessionKey, options)); } } diff --git a/src/sdk/statistics.ts b/src/sdk/statistics.ts index d6282083..2967a2b0 100644 --- a/src/sdk/statistics.ts +++ b/src/sdk/statistics.ts @@ -1,42 +1,15 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { statisticsGetBandwidthStatistics } from "../funcs/statisticsGetBandwidthStatistics.js"; +import { statisticsGetResourcesStatistics } from "../funcs/statisticsGetResourcesStatistics.js"; +import { statisticsGetStatistics } from "../funcs/statisticsGetStatistics.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Statistics extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get Media Statistics * @@ -47,71 +20,7 @@ export class Statistics extends ClientSDK { timespan?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetStatisticsRequest = { - timespan: timespan, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetStatisticsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/statistics/media")(); - - const query$ = encodeFormQuery$({ - Timespan: payload$.Timespan, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getStatistics", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetStatisticsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetStatisticsStatisticsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(statisticsGetStatistics(this, timespan, options)); } /** @@ -124,71 +33,7 @@ export class Statistics extends ClientSDK { timespan?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetResourcesStatisticsRequest = { - timespan: timespan, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetResourcesStatisticsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/statistics/resources")(); - - const query$ = encodeFormQuery$({ - Timespan: payload$.Timespan, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getResourcesStatistics", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetResourcesStatisticsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetResourcesStatisticsStatisticsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(statisticsGetResourcesStatistics(this, timespan, options)); } /** @@ -201,70 +46,6 @@ export class Statistics extends ClientSDK { timespan?: number | undefined, options?: RequestOptions ): Promise { - const input$: models.GetBandwidthStatisticsRequest = { - timespan: timespan, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetBandwidthStatisticsRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/statistics/bandwidth")(); - - const query$ = encodeFormQuery$({ - Timespan: payload$.Timespan, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getBandwidthStatistics", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetBandwidthStatisticsResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetBandwidthStatisticsStatisticsResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(statisticsGetBandwidthStatistics(this, timespan, options)); } } diff --git a/src/sdk/updater.ts b/src/sdk/updater.ts index fde9335b..01a443d5 100644 --- a/src/sdk/updater.ts +++ b/src/sdk/updater.ts @@ -1,42 +1,15 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { updaterApplyUpdates } from "../funcs/updaterApplyUpdates.js"; +import { updaterCheckForUpdates } from "../funcs/updaterCheckForUpdates.js"; +import { updaterGetUpdateStatus } from "../funcs/updaterGetUpdateStatus.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Updater extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Querying status of updates * @@ -44,58 +17,7 @@ export class Updater extends ClientSDK { * Querying status of updates */ async getUpdateStatus(options?: RequestOptions): Promise { - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const path$ = this.templateURLComponent("/updater/status")(); - - const query$ = ""; - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getUpdateStatus", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetUpdateStatusResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetUpdateStatusUpdaterResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(updaterGetUpdateStatus(this, options)); } /** @@ -108,71 +30,7 @@ export class Updater extends ClientSDK { download?: models.Download | undefined, options?: RequestOptions ): Promise { - const input$: models.CheckForUpdatesRequest = { - download: download, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.CheckForUpdatesRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/updater/check")(); - - const query$ = encodeFormQuery$({ - download: payload$.download, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "checkForUpdates", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "PUT", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.CheckForUpdatesResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.CheckForUpdatesResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(updaterCheckForUpdates(this, download, options)); } /** @@ -187,72 +45,6 @@ export class Updater extends ClientSDK { skip?: models.Skip | undefined, options?: RequestOptions ): Promise { - const input$: models.ApplyUpdatesRequest = { - tonight: tonight, - skip: skip, - }; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.ApplyUpdatesRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/updater/apply")(); - - const query$ = encodeFormQuery$({ - skip: payload$.skip, - tonight: payload$.tonight, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "applyUpdates", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "500", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "PUT", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.ApplyUpdatesResponse$) - .fail([400, "4XX", 500, "5XX"]) - .json(401, models.ApplyUpdatesResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(updaterApplyUpdates(this, tonight, skip, options)); } } diff --git a/src/sdk/user.ts b/src/sdk/user.ts new file mode 100644 index 00000000..9910cd01 --- /dev/null +++ b/src/sdk/user.ts @@ -0,0 +1,26 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { userPostUsersSigninData } from "../funcs/userPostUsersSigninData.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class User extends ClientSDK { + /** + * Get User SignIn Data + * + * @remarks + * Sign in user with username and password and return user data with Plex authentication token + */ + async postUsersSigninData( + xPlexClientIdentifier?: string | undefined, + requestBody?: models.PostUsersSigninDataRequestBody | undefined, + options?: RequestOptions & { serverURL?: string } + ): Promise { + return unwrapAsync( + userPostUsersSigninData(this, xPlexClientIdentifier, requestBody, options) + ); + } +} diff --git a/src/sdk/video.ts b/src/sdk/video.ts index 57cb887e..d21b0a69 100644 --- a/src/sdk/video.ts +++ b/src/sdk/video.ts @@ -1,42 +1,14 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { encodeFormQuery as encodeFormQuery$ } from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { videoGetTimeline } from "../funcs/videoGetTimeline.js"; +import { videoStartUniversalTranscode } from "../funcs/videoStartUniversalTranscode.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Video extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get the timeline for a media item * @@ -47,78 +19,7 @@ export class Video extends ClientSDK { request: models.GetTimelineRequest, options?: RequestOptions ): Promise { - const input$ = request; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetTimelineRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/:/timeline")(); - - const query$ = encodeFormQuery$({ - context: payload$.context, - duration: payload$.duration, - hasMDE: payload$.hasMDE, - key: payload$.key, - playBackTime: payload$.playBackTime, - playQueueItemID: payload$.playQueueItemID, - ratingKey: payload$.ratingKey, - row: payload$.row, - state: payload$.state, - time: payload$.time, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getTimeline", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.GetTimelineResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetTimelineResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(videoGetTimeline(this, request, options)); } /** @@ -131,83 +32,6 @@ export class Video extends ClientSDK { request: models.StartUniversalTranscodeRequest, options?: RequestOptions ): Promise { - const input$ = request; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.StartUniversalTranscodeRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - - const path$ = this.templateURLComponent("/video/:/transcode/universal/start.mpd")(); - - const query$ = encodeFormQuery$({ - addDebugOverlay: payload$.addDebugOverlay, - audioBoost: payload$.audioBoost, - autoAdjustQuality: payload$.autoAdjustQuality, - directPlay: payload$.directPlay, - directStream: payload$.directStream, - fastSeek: payload$.fastSeek, - hasMDE: payload$.hasMDE, - location: payload$.location, - mediaBufferSize: payload$.mediaBufferSize, - mediaIndex: payload$.mediaIndex, - partIndex: payload$.partIndex, - path: payload$.path, - protocol: payload$.protocol, - session: payload$.session, - subtites: payload$.subtites, - subtitleSize: payload$.subtitleSize, - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "startUniversalTranscode", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .void(200, models.StartUniversalTranscodeResponse$) - .fail([400, "4XX", "5XX"]) - .json(401, models.StartUniversalTranscodeResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(videoStartUniversalTranscode(this, request, options)); } } diff --git a/src/sdk/watchlist.ts b/src/sdk/watchlist.ts index f449508e..99fdf517 100644 --- a/src/sdk/watchlist.ts +++ b/src/sdk/watchlist.ts @@ -1,46 +1,13 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { SDKHooks } from "../hooks/hooks.js"; -import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config.js"; -import { - encodeFormQuery as encodeFormQuery$, - encodeSimple as encodeSimple$, -} from "../lib/encodings.js"; -import { HTTPClient } from "../lib/http.js"; -import * as schemas$ from "../lib/schemas.js"; +import { watchlistGetWatchlist } from "../funcs/watchlistGetWatchlist.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; -import { GetWatchlistOpServerList } from "../models/getwatchlistop.js"; import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; export class Watchlist extends ClientSDK { - private readonly options$: SDKOptions & { hooks?: SDKHooks }; - - constructor(options: SDKOptions = {}) { - const opt = options as unknown; - let hooks: SDKHooks; - if ( - typeof opt === "object" && - opt != null && - "hooks" in opt && - opt.hooks instanceof SDKHooks - ) { - hooks = opt.hooks; - } else { - hooks = new SDKHooks(); - } - - super({ - client: options.httpClient || new HTTPClient(), - baseURL: serverURLFromOptions(options), - hooks, - }); - - this.options$ = { ...options, hooks }; - void this.options$; - } - /** * Get User Watchlist * @@ -51,87 +18,6 @@ export class Watchlist extends ClientSDK { request: models.GetWatchlistRequest, options?: RequestOptions & { serverURL?: string } ): Promise { - const input$ = request; - const headers$ = new Headers(); - headers$.set("user-agent", SDK_METADATA.userAgent); - headers$.set("Accept", "application/json"); - - const payload$ = schemas$.parse( - input$, - (value$) => models.GetWatchlistRequest$.outboundSchema.parse(value$), - "Input validation failed" - ); - const body$ = null; - const baseURL$ = - options?.serverURL || - this.templateURLComponent(GetWatchlistOpServerList[0], { charEncoding: "percent" })(); - - const pathParams$ = { - filter: encodeSimple$("filter", payload$.filter, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = this.templateURLComponent("/library/sections/watchlist/{filter}")( - pathParams$ - ); - - const query$ = encodeFormQuery$({ - includeCollections: payload$.includeCollections, - includeExternalMedia: payload$.includeExternalMedia, - libtype: payload$.libtype, - maxresults: payload$.maxresults, - sort: payload$.sort, - "X-Plex-Container-Size": payload$["X-Plex-Container-Size"], - "X-Plex-Container-Start": payload$["X-Plex-Container-Start"], - "X-Plex-Token": payload$["X-Plex-Token"], - }); - - let security$; - if (typeof this.options$.accessToken === "function") { - security$ = { accessToken: await this.options$.accessToken() }; - } else if (this.options$.accessToken) { - security$ = { accessToken: this.options$.accessToken }; - } else { - security$ = {}; - } - const context = { - operationID: "getWatchlist", - oAuth2Scopes: [], - securitySource: this.options$.accessToken, - }; - const securitySettings$ = this.resolveGlobalSecurity(security$); - - const doOptions = { context, errorCodes: ["400", "401", "4XX", "5XX"] }; - const request$ = this.createRequest$( - context, - { - security: securitySettings$, - method: "GET", - baseURL: baseURL$, - path: path$, - headers: headers$, - query: query$, - body: body$, - }, - options - ); - - const response = await this.do$(request$, doOptions); - - const responseFields$ = { - ContentType: response.headers.get("content-type") ?? "application/octet-stream", - StatusCode: response.status, - RawResponse: response, - Headers: {}, - }; - - const [result$] = await this.matcher() - .json(200, models.GetWatchlistResponse$, { key: "object" }) - .fail([400, "4XX", "5XX"]) - .json(401, models.GetWatchlistWatchlistResponseBody$, { err: true }) - .match(response, { extraFields: responseFields$ }); - - return result$; + return unwrapAsync(watchlistGetWatchlist(this, request, options)); } } diff --git a/src/types/blobs.ts b/src/types/blobs.ts index cbb8a57f..4ce84602 100644 --- a/src/types/blobs.ts +++ b/src/types/blobs.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; diff --git a/src/types/constdatetime.ts b/src/types/constdatetime.ts new file mode 100644 index 00000000..c0a4409c --- /dev/null +++ b/src/types/constdatetime.ts @@ -0,0 +1,15 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export function constDateTime( + val: string, +): z.ZodType { + return z.custom((v) => { + return ( + typeof v === "string" && new Date(v).getTime() === new Date(val).getTime() + ); + }, `Value must be equivelant to ${val}`); +} diff --git a/src/types/enums.ts b/src/types/enums.ts index 4de0142b..6fb6d910 100644 --- a/src/types/enums.ts +++ b/src/types/enums.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ declare const __brand: unique symbol; diff --git a/src/types/fp.ts b/src/types/fp.ts new file mode 100644 index 00000000..ccbe51ea --- /dev/null +++ b/src/types/fp.ts @@ -0,0 +1,50 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/** + * A monad that captures the result of a function call or an error if it was not + * successful. Railway programming, enabled by this type, can be a nicer + * alternative to traditional exception throwing because it allows functions to + * declare all _known_ errors with static types and then check for them + * exhaustively in application code. Thrown exception have a type of `unknown` + * and break out of regular control flow of programs making them harder to + * inspect and more verbose work with due to try-catch blocks. + */ +export type Result = + | { ok: true; value: T; error?: never } + | { ok: false; value?: never; error: E }; + +export function OK(value: V): Result { + return { ok: true, value }; +} + +export function ERR(error: E): Result { + return { ok: false, error }; +} + +/** + * unwrap is a convenience function for extracting a value from a result or + * throwing if there was an error. + */ +export function unwrap(r: Result): T { + if (!r.ok) { + throw r.error; + } + return r.value; +} + +/** + * unwrapAsync is a convenience function for resolving a value from a Promise + * of a result or rejecting if an error occurred. + */ +export async function unwrapAsync( + pr: Promise>, +): Promise { + const r = await pr; + if (!r.ok) { + throw r.error; + } + + return r.value; +} diff --git a/src/types/index.ts b/src/types/index.ts index 374373e9..dbaa5e6e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ export { RFCDate } from "./rfcdate.js"; @@ -8,3 +8,4 @@ export type { Paginator, PageIterator } from "./operations.js"; export { createPageIterator } from "./operations.js"; export { catchUnrecognizedEnum } from "./enums.js"; export type { OpenEnum, ClosedEnum, Unrecognized } from "./enums.js"; +export type { Result } from "./fp.js"; diff --git a/src/types/operations.ts b/src/types/operations.ts index 7f833514..0952f6f4 100644 --- a/src/types/operations.ts +++ b/src/types/operations.ts @@ -1,25 +1,99 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -export type Paginator = () => Promise> | null; +import { Result } from "./fp.js"; -export type PageIterator = Result & { - next: Paginator; - [Symbol.asyncIterator]: () => AsyncIterableIterator; +export type Paginator = () => Promise }> | null; + +export type PageIterator = V & { + next: Paginator; + [Symbol.asyncIterator]: () => AsyncIterableIterator; }; -export function createPageIterator( - page: Result & { next: Paginator }, -): { [Symbol.asyncIterator]: () => AsyncIterableIterator } { +export function createPageIterator( + page: V & { next: Paginator }, + halt: (v: V) => boolean, +): { + [Symbol.asyncIterator]: () => AsyncIterableIterator; +} { return { [Symbol.asyncIterator]: async function* paginator() { yield page; + if (halt(page)) { + return; + } let p: typeof page | null = page; for (p = await p.next(); p != null; p = await p.next()) { yield p; + if (halt(p)) { + return; + } } }, }; } + +/** + * This utility create a special iterator that yields a single value and + * terminates. It is useful in paginated SDK functions that have early return + * paths when things go wrong. + */ +export function haltIterator(v: V): PageIterator { + return { + ...v, + next: () => null, + [Symbol.asyncIterator]: async function* paginator() { + yield v; + }, + }; +} + +/** + * Converts an async iterator of `Result` into an async iterator of `V`. + * When error results occur, the underlying error value is thrown. + */ +export async function unwrapResultIterator( + iteratorPromise: Promise>>, +): Promise> { + const resultIter = await iteratorPromise; + + if (!resultIter.ok) { + throw resultIter.error; + } + + return { + ...resultIter.value, + next: unwrapPaginator(resultIter.next), + [Symbol.asyncIterator]: async function* paginator() { + for await (const page of resultIter) { + if (!page.ok) { + throw page.error; + } + yield page.value; + } + }, + }; +} + +function unwrapPaginator( + paginator: Paginator>, +): Paginator { + return () => { + const nextResult = paginator(); + if (nextResult == null) { + return null; + } + return nextResult.then((res) => { + if (!res.ok) { + throw res.error; + } + const out = { + ...res.value, + next: unwrapPaginator(res.next), + }; + return out; + }); + }; +} diff --git a/src/types/rfcdate.ts b/src/types/rfcdate.ts index e80b6932..c79b3f53 100644 --- a/src/types/rfcdate.ts +++ b/src/types/rfcdate.ts @@ -1,5 +1,5 @@ /* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ const dateRE = /^\d{4}-\d{2}-\d{2}$/;