From e9cfd11a9c1717251be84da48a8f55c6e6450dd8 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 23 Jan 2024 20:48:45 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.150.0 --- .speakeasy/gen.lock | 17 +- README.md | 1 + RELEASES.md | 12 +- .../operations/createplaylistrequest.md | 14 +- .../gettransienttokenqueryparamtype.md | 10 + .../operations/gettransienttokenrequest.md | 8 +- docs/models/operations/queryparamtype.md | 10 +- .../operations/searchlibrarymediacontainer.md | 20 + .../operations/searchlibrarymetadata.md | 27 + .../models/operations/searchlibraryrequest.md | 9 + .../operations/searchlibraryresponse.md | 11 + .../operations/searchlibraryresponsebody.md | 10 + docs/models/operations/tag.md | 43 +- docs/models/operations/typet.md | 9 +- docs/sdks/library/README.md | 66 ++- docs/sdks/playlists/README.md | 4 +- docs/sdks/security/README.md | 6 +- gen.yaml | 2 +- package-lock.json | 4 +- package.json | 2 +- src/lib/config.ts | 4 +- src/models/operations/createplaylist.ts | 14 +- src/models/operations/getlibraryitems.ts | 1 - src/models/operations/gettransienttoken.ts | 14 +- src/models/operations/index.ts | 1 + src/models/operations/searchlibrary.ts | 469 ++++++++++++++++++ src/sdk/library.ts | 99 +++- src/sdk/security.ts | 2 +- 28 files changed, 813 insertions(+), 76 deletions(-) create mode 100644 docs/models/operations/gettransienttokenqueryparamtype.md create mode 100644 docs/models/operations/searchlibrarymediacontainer.md create mode 100644 docs/models/operations/searchlibrarymetadata.md create mode 100644 docs/models/operations/searchlibraryrequest.md create mode 100644 docs/models/operations/searchlibraryresponse.md create mode 100644 docs/models/operations/searchlibraryresponsebody.md create mode 100644 src/models/operations/searchlibrary.ts diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5e31751b..fa8ecf20 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: 7aba498c024534142941d65a7c2e649c + docChecksum: 49e77b550f057eb568502dc74fee7cce docVersion: 0.0.3 speakeasyVersion: internal generationVersion: 2.237.3 - releaseVersion: 0.5.1 - configChecksum: 168d1f69c7615425697deab74877acce + releaseVersion: 0.5.2 + configChecksum: f02b714f61d5a9ec0ae43736eea71917 repoURL: https://github.com/LukeHagar/plexjs.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexjs @@ -88,6 +88,7 @@ generatedFiles: - src/models/operations/deletelibrary.ts - src/models/operations/getlibraryitems.ts - src/models/operations/refreshlibrary.ts + - src/models/operations/searchlibrary.ts - src/models/operations/getmetadata.ts - src/models/operations/getmetadatachildren.ts - src/models/operations/getondeck.ts @@ -316,6 +317,12 @@ generatedFiles: - docs/models/operations/getlibraryitemsresponse.md - docs/models/operations/refreshlibraryrequest.md - docs/models/operations/refreshlibraryresponse.md + - docs/models/operations/typet.md + - docs/models/operations/searchlibraryrequest.md + - docs/models/operations/searchlibrarymetadata.md + - docs/models/operations/searchlibrarymediacontainer.md + - docs/models/operations/searchlibraryresponsebody.md + - docs/models/operations/searchlibraryresponse.md - docs/models/operations/getmetadatarequest.md - docs/models/operations/stream.md - docs/models/operations/getmetadatapart.md @@ -351,7 +358,7 @@ generatedFiles: - docs/models/operations/loglineresponse.md - docs/models/operations/logmultilineresponse.md - docs/models/operations/enablepapertrailresponse.md - - docs/models/operations/typet.md + - docs/models/operations/queryparamtype.md - docs/models/operations/smart.md - docs/models/operations/createplaylistrequest.md - docs/models/operations/createplaylistmetadata.md @@ -396,7 +403,7 @@ generatedFiles: - docs/models/operations/force.md - docs/models/operations/uploadplaylistrequest.md - docs/models/operations/uploadplaylistresponse.md - - docs/models/operations/queryparamtype.md + - docs/models/operations/gettransienttokenqueryparamtype.md - docs/models/operations/scope.md - docs/models/operations/gettransienttokenrequest.md - docs/models/operations/gettransienttokenresponse.md diff --git a/README.md b/README.md index 45669691..a2a4985c 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ run(); * [deleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section * [getLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items * [refreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library +* [searchLibrary](docs/sdks/library/README.md#searchlibrary) - Search Library * [getMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata * [getMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children * [getOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck diff --git a/RELEASES.md b/RELEASES.md index 3c601b5f..bc398494 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -128,4 +128,14 @@ Based on: ### Generated - [typescript v0.5.1] . ### Releases -- [NPM v0.5.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.5.1 - . \ No newline at end of file +- [NPM v0.5.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.5.1 - . + +## 2024-01-23 20:47:26 +### Changes +Based on: +- OpenAPI Doc 0.0.3 +- Speakeasy CLI 1.150.0 (2.237.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.5.2] . +### Releases +- [NPM v0.5.2] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.5.2 - . \ No newline at end of file diff --git a/docs/models/operations/createplaylistrequest.md b/docs/models/operations/createplaylistrequest.md index 9d78895d..f65cce2d 100644 --- a/docs/models/operations/createplaylistrequest.md +++ b/docs/models/operations/createplaylistrequest.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `title` | *string* | :heavy_check_mark: | name of the playlist | -| `type` | [operations.TypeT](../../models/operations/typet.md) | :heavy_check_mark: | type of playlist to create | -| `smart` | [operations.Smart](../../models/operations/smart.md) | :heavy_check_mark: | whether the playlist is smart or not | -| `uri` | *string* | :heavy_check_mark: | the content URI for the playlist | -| `playQueueID` | *number* | :heavy_minus_sign: | the play queue to copy to a playlist | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `title` | *string* | :heavy_check_mark: | name of the playlist | +| `type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | type of playlist to create | +| `smart` | [operations.Smart](../../models/operations/smart.md) | :heavy_check_mark: | whether the playlist is smart or not | +| `uri` | *string* | :heavy_check_mark: | the content URI for the playlist | +| `playQueueID` | *number* | :heavy_minus_sign: | the play queue to copy to a playlist | \ No newline at end of file diff --git a/docs/models/operations/gettransienttokenqueryparamtype.md b/docs/models/operations/gettransienttokenqueryparamtype.md new file mode 100644 index 00000000..ed8d4a47 --- /dev/null +++ b/docs/models/operations/gettransienttokenqueryparamtype.md @@ -0,0 +1,10 @@ +# GetTransientTokenQueryParamType + +`delegation` - This is the only supported `type` parameter. + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `Delegation` | delegation | \ No newline at end of file diff --git a/docs/models/operations/gettransienttokenrequest.md b/docs/models/operations/gettransienttokenrequest.md index 7f318b4f..23ce0e9f 100644 --- a/docs/models/operations/gettransienttokenrequest.md +++ b/docs/models/operations/gettransienttokenrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | -| `scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `type` | [operations.GetTransientTokenQueryParamType](../../models/operations/gettransienttokenqueryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | +| `scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. | \ No newline at end of file diff --git a/docs/models/operations/queryparamtype.md b/docs/models/operations/queryparamtype.md index 86cdced7..549a0c1d 100644 --- a/docs/models/operations/queryparamtype.md +++ b/docs/models/operations/queryparamtype.md @@ -1,10 +1,12 @@ # QueryParamType -`delegation` - This is the only supported `type` parameter. +type of playlist to create ## Values -| Name | Value | -| ------------ | ------------ | -| `Delegation` | delegation | \ No newline at end of file +| Name | Value | +| ------- | ------- | +| `Audio` | audio | +| `Video` | video | +| `Photo` | photo | \ No newline at end of file diff --git a/docs/models/operations/searchlibrarymediacontainer.md b/docs/models/operations/searchlibrarymediacontainer.md new file mode 100644 index 00000000..68cc2040 --- /dev/null +++ b/docs/models/operations/searchlibrarymediacontainer.md @@ -0,0 +1,20 @@ +# SearchLibraryMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `size` | *number* | :heavy_minus_sign: | N/A | 2 | +| `allowSync` | *boolean* | :heavy_minus_sign: | N/A | false | +| `art` | *string* | :heavy_minus_sign: | N/A | /:/resources/show-fanart.jpg | +| `identifier` | *string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | +| `mediaTagPrefix` | *string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | +| `mediaTagVersion` | *number* | :heavy_minus_sign: | N/A | 1698860922 | +| `nocache` | *boolean* | :heavy_minus_sign: | N/A | true | +| `thumb` | *string* | :heavy_minus_sign: | N/A | /:/resources/show.png | +| `title1` | *string* | :heavy_minus_sign: | N/A | TV Shows | +| `title2` | *string* | :heavy_minus_sign: | N/A | Search for '' | +| `viewGroup` | *string* | :heavy_minus_sign: | N/A | season | +| `viewMode` | *number* | :heavy_minus_sign: | N/A | 65593 | +| `metadata` | [operations.SearchLibraryMetadata](../../models/operations/searchlibrarymetadata.md)[] | :heavy_minus_sign: | N/A | [{"addedAt":1705636916,"art":"/library/metadata/1/art/1705636920","guid":"plex://season/602e67e766dfdb002c0a1b5b","index":1,"key":"/library/metadata/2/children","parentGuid":"plex://show/5d9c086c7d06d9001ffd27aa","parentIndex":1,"parentKey":"/library/metadata/1","parentRatingKey":"1","parentStudio":"Mutant Enemy Productions","parentTheme":"/library/metadata/1/theme/1705636920","parentThumb":"/library/metadata/1/thumb/1705636920","parentTitle":"Firefly","parentYear":2002,"ratingKey":"2","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.","thumb":"/library/metadata/2/thumb/1705636920","title":"Season 1","type":"season","updatedAt":1705636920}] | \ No newline at end of file diff --git a/docs/models/operations/searchlibrarymetadata.md b/docs/models/operations/searchlibrarymetadata.md new file mode 100644 index 00000000..ee42b14d --- /dev/null +++ b/docs/models/operations/searchlibrarymetadata.md @@ -0,0 +1,27 @@ +# SearchLibraryMetadata + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ratingKey` | *string* | :heavy_minus_sign: | N/A | 2 | +| `key` | *string* | :heavy_minus_sign: | N/A | /library/metadata/2/children | +| `parentRatingKey` | *string* | :heavy_minus_sign: | N/A | 1 | +| `guid` | *string* | :heavy_minus_sign: | N/A | plex://season/602e67e766dfdb002c0a1b5b | +| `parentGuid` | *string* | :heavy_minus_sign: | N/A | plex://show/5d9c086c7d06d9001ffd27aa | +| `parentStudio` | *string* | :heavy_minus_sign: | N/A | Mutant Enemy Productions | +| `type` | *string* | :heavy_minus_sign: | N/A | season | +| `title` | *string* | :heavy_minus_sign: | N/A | Season 1 | +| `parentKey` | *string* | :heavy_minus_sign: | N/A | /library/metadata/1 | +| `parentTitle` | *string* | :heavy_minus_sign: | N/A | Firefly | +| `summary` | *string* | :heavy_minus_sign: | N/A | 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` | *number* | :heavy_minus_sign: | N/A | 1 | +| `parentIndex` | *number* | :heavy_minus_sign: | N/A | 1 | +| `parentYear` | *number* | :heavy_minus_sign: | N/A | 2002 | +| `thumb` | *string* | :heavy_minus_sign: | N/A | /library/metadata/2/thumb/1705636920 | +| `art` | *string* | :heavy_minus_sign: | N/A | /library/metadata/1/art/1705636920 | +| `parentThumb` | *string* | :heavy_minus_sign: | N/A | /library/metadata/1/thumb/1705636920 | +| `parentTheme` | *string* | :heavy_minus_sign: | N/A | /library/metadata/1/theme/1705636920 | +| `addedAt` | *number* | :heavy_minus_sign: | N/A | 1705636916 | +| `updatedAt` | *number* | :heavy_minus_sign: | N/A | 1705636920 | \ No newline at end of file diff --git a/docs/models/operations/searchlibraryrequest.md b/docs/models/operations/searchlibraryrequest.md new file mode 100644 index 00000000..517c9e39 --- /dev/null +++ b/docs/models/operations/searchlibraryrequest.md @@ -0,0 +1,9 @@ +# SearchLibraryRequest + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `sectionId` | *number* | :heavy_check_mark: | the Id of the library to query | +| `type` | [operations.TypeT](../../models/operations/typet.md) | :heavy_check_mark: | Plex content type to search for | \ No newline at end of file diff --git a/docs/models/operations/searchlibraryresponse.md b/docs/models/operations/searchlibraryresponse.md new file mode 100644 index 00000000..cb6c6f62 --- /dev/null +++ b/docs/models/operations/searchlibraryresponse.md @@ -0,0 +1,11 @@ +# SearchLibraryResponse + + +## 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` | [operations.SearchLibraryResponseBody](../../models/operations/searchlibraryresponsebody.md) | :heavy_minus_sign: | The contents of the library by section and type | \ No newline at end of file diff --git a/docs/models/operations/searchlibraryresponsebody.md b/docs/models/operations/searchlibraryresponsebody.md new file mode 100644 index 00000000..69a8eea1 --- /dev/null +++ b/docs/models/operations/searchlibraryresponsebody.md @@ -0,0 +1,10 @@ +# SearchLibraryResponseBody + +The contents of the library by section and type + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `mediaContainer` | [operations.SearchLibraryMediaContainer](../../models/operations/searchlibrarymediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/tag.md b/docs/models/operations/tag.md index e5f42b9b..99c8927f 100644 --- a/docs/models/operations/tag.md +++ b/docs/models/operations/tag.md @@ -5,25 +5,24 @@ A key representing a specific tag within the section. ## Values -| Name | Value | -| ------------------ | ------------------ | -| `All` | all | -| `Unwatched` | unwatched | -| `Newest` | newest | -| `RecentlyAdded` | recentlyAdded | -| `RecentlyViewed` | recentlyViewed | -| `OnDeck` | onDeck | -| `Collection` | collection | -| `Edition` | edition | -| `Genre` | genre | -| `Year` | year | -| `Decade` | decade | -| `Director` | director | -| `Actor` | actor | -| `Country` | country | -| `ContentRating` | contentRating | -| `Rating` | rating | -| `Resolution` | resolution | -| `FirstCharacter` | firstCharacter | -| `Folder` | folder | -| `SearchTypeEqual1` | search?type=1 | \ No newline at end of file +| Name | Value | +| ---------------- | ---------------- | +| `All` | all | +| `Unwatched` | unwatched | +| `Newest` | newest | +| `RecentlyAdded` | recentlyAdded | +| `RecentlyViewed` | recentlyViewed | +| `OnDeck` | onDeck | +| `Collection` | collection | +| `Edition` | edition | +| `Genre` | genre | +| `Year` | year | +| `Decade` | decade | +| `Director` | director | +| `Actor` | actor | +| `Country` | country | +| `ContentRating` | contentRating | +| `Rating` | rating | +| `Resolution` | resolution | +| `FirstCharacter` | firstCharacter | +| `Folder` | folder | \ No newline at end of file diff --git a/docs/models/operations/typet.md b/docs/models/operations/typet.md index 7d855c29..a4344f73 100644 --- a/docs/models/operations/typet.md +++ b/docs/models/operations/typet.md @@ -1,12 +1,13 @@ # TypeT -type of playlist to create +Plex content type to search for ## Values | Name | Value | | ------- | ------- | -| `Audio` | audio | -| `Video` | video | -| `Photo` | photo | \ No newline at end of file +| `One` | 1 | +| `Two` | 2 | +| `Three` | 3 | +| `Four` | 4 | \ No newline at end of file diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index 5d921b55..c3436b6f 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -15,6 +15,7 @@ API Calls interacting with Plex Media Server Libraries * [deleteLibrary](#deletelibrary) - Delete Library Section * [getLibraryItems](#getlibraryitems) - Get Library Items * [refreshLibrary](#refreshlibrary) - Refresh Library +* [searchLibrary](#searchlibrary) - Search Library * [getMetadata](#getmetadata) - Get Items Metadata * [getMetadataChildren](#getmetadatachildren) - Get Items Children * [getOnDeck](#getondeck) - Get On Deck @@ -306,7 +307,6 @@ Fetches details from a specific section of the library identified by a section k - `resolution`: Items categorized by resolution. - `firstCharacter`: Items categorized by the first letter. - `folder`: Items categorized by folder. -- `search?type=1`: Search functionality within the section. ### Example Usage @@ -396,6 +396,70 @@ run(); | errors.RefreshLibraryResponseBody | 401 | application/json | | errors.SDKError | 4xx-5xx | */* | +## searchLibrary + +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. + + +### Example Usage + +```typescript +import { PlexAPI } from "@lukehagar/plexjs"; +import { TypeT } from "@lukehagar/plexjs/models/operations"; + +async function run() { + const sdk = new PlexAPI({ + accessToken: "", + }); + + const sectionId = 933505; + const type = TypeT.Four; + + const result = await sdk.library.searchLibrary(sectionId, type); + + // Handle the result + console.log(result) +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `sectionId` | *number* | :heavy_check_mark: | the Id of the library to query | +| `type` | [operations.TypeT](../../models/operations/typet.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. | + + +### Response + +**Promise<[operations.SearchLibraryResponse](../../models/operations/searchlibraryresponse.md)>** +### Errors + +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | + ## getMetadata This endpoint will return the metadata of a library item specified with the ratingKey. diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md index db199488..d3df3a34 100644 --- a/docs/sdks/playlists/README.md +++ b/docs/sdks/playlists/README.md @@ -32,7 +32,7 @@ Create a new playlist. By default the playlist is blank. To create a playlist al ```typescript import { PlexAPI } from "@lukehagar/plexjs"; -import { Smart, TypeT } from "@lukehagar/plexjs/models/operations"; +import { QueryParamType, Smart } from "@lukehagar/plexjs/models/operations"; async function run() { const sdk = new PlexAPI({ @@ -41,7 +41,7 @@ async function run() { const result = await sdk.playlists.createPlaylist({ title: "string", - type: TypeT.Photo, + type: QueryParamType.Photo, smart: Smart.One, uri: "https://inborn-brochure.biz", }); diff --git a/docs/sdks/security/README.md b/docs/sdks/security/README.md index 3f8aaf75..80d383f7 100644 --- a/docs/sdks/security/README.md +++ b/docs/sdks/security/README.md @@ -20,14 +20,14 @@ This endpoint provides the caller with a temporary token with the same access le ```typescript import { PlexAPI } from "@lukehagar/plexjs"; -import { QueryParamType, Scope } from "@lukehagar/plexjs/models/operations"; +import { GetTransientTokenQueryParamType, Scope } from "@lukehagar/plexjs/models/operations"; async function run() { const sdk = new PlexAPI({ accessToken: "", }); - const type = QueryParamType.Delegation; + const type = GetTransientTokenQueryParamType.Delegation; const scope = Scope.All; const result = await sdk.security.getTransientToken(type, scope); @@ -43,7 +43,7 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | +| `type` | [operations.GetTransientTokenQueryParamType](../../models/operations/gettransienttokenqueryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | | `scope` | [operations.Scope](../../models/operations/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. | diff --git a/gen.yaml b/gen.yaml index 0c1ae1cb..0eda6bf9 100755 --- a/gen.yaml +++ b/gen.yaml @@ -8,7 +8,7 @@ generation: fixes: nameResolutionDec2023: false typescript: - version: 0.5.1 + version: 0.5.2 author: LukeHagar clientServerStatusCodesAsErrors: true flattenGlobalSecurity: true diff --git a/package-lock.json b/package-lock.json index 1a9474e8..e481485d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lukehagar/plexjs", - "version": "0.5.1", + "version": "0.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lukehagar/plexjs", - "version": "0.5.1", + "version": "0.5.2", "dependencies": { "decimal.js": "^10.4.3", "jsonpath": "^1.1.1" diff --git a/package.json b/package.json index fe761f28..528fecd9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "commonjs", "name": "@lukehagar/plexjs", - "version": "0.5.1", + "version": "0.5.2", "author": "LukeHagar", "main": "./index.js", "sideEffects": false, diff --git a/src/lib/config.ts b/src/lib/config.ts index a034fb71..1950183e 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL { export const SDK_METADATA = Object.freeze({ language: "typescript", openapiDocVersion: "0.0.3", - sdkVersion: "0.5.1", + sdkVersion: "0.5.2", genVersion: "2.237.3", - userAgent: "speakeasy-sdk/typescript 0.5.1 2.237.3 0.0.3 @lukehagar/plexjs", + userAgent: "speakeasy-sdk/typescript 0.5.2 2.237.3 0.0.3 @lukehagar/plexjs", }); diff --git a/src/models/operations/createplaylist.ts b/src/models/operations/createplaylist.ts index 5401d611..df772e28 100644 --- a/src/models/operations/createplaylist.ts +++ b/src/models/operations/createplaylist.ts @@ -7,7 +7,7 @@ import { z } from "zod"; /** * type of playlist to create */ -export enum TypeT { +export enum QueryParamType { Audio = "audio", Video = "video", Photo = "photo", @@ -29,7 +29,7 @@ export type CreatePlaylistRequest = { /** * type of playlist to create */ - type: TypeT; + type: QueryParamType; /** * whether the playlist is smart or not */ @@ -95,7 +95,7 @@ export type CreatePlaylistResponse = { }; /** @internal */ -export const TypeT$ = z.nativeEnum(TypeT); +export const QueryParamType$ = z.nativeEnum(QueryParamType); /** @internal */ export const Smart$ = z.nativeEnum(Smart); @@ -104,7 +104,7 @@ export const Smart$ = z.nativeEnum(Smart); export namespace CreatePlaylistRequest$ { export type Inbound = { title: string; - type: TypeT; + type: QueryParamType; smart: Smart; uri: string; playQueueID?: number | undefined; @@ -113,7 +113,7 @@ export namespace CreatePlaylistRequest$ { export const inboundSchema: z.ZodType = z .object({ title: z.string(), - type: TypeT$, + type: QueryParamType$, smart: Smart$, uri: z.string(), playQueueID: z.number().optional(), @@ -130,7 +130,7 @@ export namespace CreatePlaylistRequest$ { export type Outbound = { title: string; - type: TypeT; + type: QueryParamType; smart: Smart; uri: string; playQueueID?: number | undefined; @@ -139,7 +139,7 @@ export namespace CreatePlaylistRequest$ { export const outboundSchema: z.ZodType = z .object({ title: z.string(), - type: TypeT$, + type: QueryParamType$, smart: Smart$, uri: z.string(), playQueueID: z.number().optional(), diff --git a/src/models/operations/getlibraryitems.ts b/src/models/operations/getlibraryitems.ts index 607db6cb..f9e50730 100644 --- a/src/models/operations/getlibraryitems.ts +++ b/src/models/operations/getlibraryitems.ts @@ -28,7 +28,6 @@ export enum Tag { Resolution = "resolution", FirstCharacter = "firstCharacter", Folder = "folder", - SearchTypeEqual1 = "search?type=1", } export type GetLibraryItemsRequest = { diff --git a/src/models/operations/gettransienttoken.ts b/src/models/operations/gettransienttoken.ts index f3c4705b..2ab46652 100644 --- a/src/models/operations/gettransienttoken.ts +++ b/src/models/operations/gettransienttoken.ts @@ -7,7 +7,7 @@ import { z } from "zod"; /** * `delegation` - This is the only supported `type` parameter. */ -export enum QueryParamType { +export enum GetTransientTokenQueryParamType { Delegation = "delegation", } @@ -22,7 +22,7 @@ export type GetTransientTokenRequest = { /** * `delegation` - This is the only supported `type` parameter. */ - type: QueryParamType; + type: GetTransientTokenQueryParamType; /** * `all` - This is the only supported `scope` parameter. */ @@ -45,7 +45,7 @@ export type GetTransientTokenResponse = { }; /** @internal */ -export const QueryParamType$ = z.nativeEnum(QueryParamType); +export const GetTransientTokenQueryParamType$ = z.nativeEnum(GetTransientTokenQueryParamType); /** @internal */ export const Scope$ = z.nativeEnum(Scope); @@ -53,13 +53,13 @@ export const Scope$ = z.nativeEnum(Scope); /** @internal */ export namespace GetTransientTokenRequest$ { export type Inbound = { - type: QueryParamType; + type: GetTransientTokenQueryParamType; scope: Scope; }; export const inboundSchema: z.ZodType = z .object({ - type: QueryParamType$, + type: GetTransientTokenQueryParamType$, scope: Scope$, }) .transform((v) => { @@ -70,13 +70,13 @@ export namespace GetTransientTokenRequest$ { }); export type Outbound = { - type: QueryParamType; + type: GetTransientTokenQueryParamType; scope: Scope; }; export const outboundSchema: z.ZodType = z .object({ - type: QueryParamType$, + type: GetTransientTokenQueryParamType$, scope: Scope$, }) .transform((v) => { diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts index 4d670f10..27697114 100644 --- a/src/models/operations/index.ts +++ b/src/models/operations/index.ts @@ -49,6 +49,7 @@ export * from "./markunplayed"; export * from "./performsearch"; export * from "./performvoicesearch"; export * from "./refreshlibrary"; +export * from "./searchlibrary"; export * from "./startalltasks"; export * from "./starttask"; export * from "./startuniversaltranscode"; diff --git a/src/models/operations/searchlibrary.ts b/src/models/operations/searchlibrary.ts new file mode 100644 index 00000000..ce953851 --- /dev/null +++ b/src/models/operations/searchlibrary.ts @@ -0,0 +1,469 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +import { z } from "zod"; + +/** + * Plex content type to search for + */ +export enum TypeT { + One = 1, + Two = 2, + Three = 3, + Four = 4, +} + +export type SearchLibraryRequest = { + /** + * the Id of the library to query + */ + sectionId: number; + /** + * Plex content type to search for + */ + type: TypeT; +}; + +export type SearchLibraryMetadata = { + 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 type SearchLibraryMediaContainer = { + 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; +}; + +/** + * The contents of the library by section and type + */ +export type SearchLibraryResponseBody = { + mediaContainer?: SearchLibraryMediaContainer | undefined; +}; + +export type SearchLibraryResponse = { + /** + * 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 contents of the library by section and type + */ + object?: SearchLibraryResponseBody | undefined; +}; + +/** @internal */ +export const TypeT$ = z.nativeEnum(TypeT); + +/** @internal */ +export namespace SearchLibraryRequest$ { + export type Inbound = { + sectionId: number; + type: TypeT; + }; + + export const inboundSchema: z.ZodType = z + .object({ + sectionId: z.number().int(), + type: TypeT$, + }) + .transform((v) => { + return { + sectionId: v.sectionId, + type: v.type, + }; + }); + + export type Outbound = { + sectionId: number; + type: TypeT; + }; + + export const outboundSchema: z.ZodType = z + .object({ + sectionId: z.number().int(), + type: TypeT$, + }) + .transform((v) => { + return { + sectionId: v.sectionId, + type: v.type, + }; + }); +} + +/** @internal */ +export namespace SearchLibraryMetadata$ { + export type Inbound = { + 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 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(), + art: z.string().optional(), + parentThumb: z.string().optional(), + parentTheme: z.string().optional(), + addedAt: z.number().int().optional(), + updatedAt: z.number().int().optional(), + }) + .transform((v) => { + return { + ...(v.ratingKey === undefined ? null : { ratingKey: v.ratingKey }), + ...(v.key === undefined ? null : { key: v.key }), + ...(v.parentRatingKey === undefined + ? null + : { parentRatingKey: v.parentRatingKey }), + ...(v.guid === undefined ? null : { guid: v.guid }), + ...(v.parentGuid === undefined ? null : { parentGuid: v.parentGuid }), + ...(v.parentStudio === undefined ? null : { parentStudio: v.parentStudio }), + ...(v.type === undefined ? null : { type: v.type }), + ...(v.title === undefined ? null : { title: v.title }), + ...(v.parentKey === undefined ? null : { parentKey: v.parentKey }), + ...(v.parentTitle === undefined ? null : { parentTitle: v.parentTitle }), + ...(v.summary === undefined ? null : { summary: v.summary }), + ...(v.index === undefined ? null : { index: v.index }), + ...(v.parentIndex === undefined ? null : { parentIndex: v.parentIndex }), + ...(v.parentYear === undefined ? null : { parentYear: v.parentYear }), + ...(v.thumb === undefined ? null : { thumb: v.thumb }), + ...(v.art === undefined ? null : { art: v.art }), + ...(v.parentThumb === undefined ? null : { parentThumb: v.parentThumb }), + ...(v.parentTheme === undefined ? null : { parentTheme: v.parentTheme }), + ...(v.addedAt === undefined ? null : { addedAt: v.addedAt }), + ...(v.updatedAt === undefined ? null : { updatedAt: v.updatedAt }), + }; + }); + + 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(), + }) + .transform((v) => { + return { + ...(v.ratingKey === undefined ? null : { ratingKey: v.ratingKey }), + ...(v.key === undefined ? null : { key: v.key }), + ...(v.parentRatingKey === undefined + ? null + : { parentRatingKey: v.parentRatingKey }), + ...(v.guid === undefined ? null : { guid: v.guid }), + ...(v.parentGuid === undefined ? null : { parentGuid: v.parentGuid }), + ...(v.parentStudio === undefined ? null : { parentStudio: v.parentStudio }), + ...(v.type === undefined ? null : { type: v.type }), + ...(v.title === undefined ? null : { title: v.title }), + ...(v.parentKey === undefined ? null : { parentKey: v.parentKey }), + ...(v.parentTitle === undefined ? null : { parentTitle: v.parentTitle }), + ...(v.summary === undefined ? null : { summary: v.summary }), + ...(v.index === undefined ? null : { index: v.index }), + ...(v.parentIndex === undefined ? null : { parentIndex: v.parentIndex }), + ...(v.parentYear === undefined ? null : { parentYear: v.parentYear }), + ...(v.thumb === undefined ? null : { thumb: v.thumb }), + ...(v.art === undefined ? null : { art: v.art }), + ...(v.parentThumb === undefined ? null : { parentThumb: v.parentThumb }), + ...(v.parentTheme === undefined ? null : { parentTheme: v.parentTheme }), + ...(v.addedAt === undefined ? null : { addedAt: v.addedAt }), + ...(v.updatedAt === undefined ? null : { updatedAt: v.updatedAt }), + }; + }); +} + +/** @internal */ +export namespace SearchLibraryMediaContainer$ { + export type Inbound = { + 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 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 { + ...(v.size === undefined ? null : { size: v.size }), + ...(v.allowSync === undefined ? null : { allowSync: v.allowSync }), + ...(v.art === undefined ? null : { art: v.art }), + ...(v.identifier === undefined ? null : { identifier: v.identifier }), + ...(v.mediaTagPrefix === undefined ? null : { mediaTagPrefix: v.mediaTagPrefix }), + ...(v.mediaTagVersion === undefined + ? null + : { mediaTagVersion: v.mediaTagVersion }), + ...(v.nocache === undefined ? null : { nocache: v.nocache }), + ...(v.thumb === undefined ? null : { thumb: v.thumb }), + ...(v.title1 === undefined ? null : { title1: v.title1 }), + ...(v.title2 === undefined ? null : { title2: v.title2 }), + ...(v.viewGroup === undefined ? null : { viewGroup: v.viewGroup }), + ...(v.viewMode === undefined ? null : { viewMode: v.viewMode }), + ...(v.Metadata === undefined ? null : { metadata: v.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 { + ...(v.size === undefined ? null : { size: v.size }), + ...(v.allowSync === undefined ? null : { allowSync: v.allowSync }), + ...(v.art === undefined ? null : { art: v.art }), + ...(v.identifier === undefined ? null : { identifier: v.identifier }), + ...(v.mediaTagPrefix === undefined ? null : { mediaTagPrefix: v.mediaTagPrefix }), + ...(v.mediaTagVersion === undefined + ? null + : { mediaTagVersion: v.mediaTagVersion }), + ...(v.nocache === undefined ? null : { nocache: v.nocache }), + ...(v.thumb === undefined ? null : { thumb: v.thumb }), + ...(v.title1 === undefined ? null : { title1: v.title1 }), + ...(v.title2 === undefined ? null : { title2: v.title2 }), + ...(v.viewGroup === undefined ? null : { viewGroup: v.viewGroup }), + ...(v.viewMode === undefined ? null : { viewMode: v.viewMode }), + ...(v.metadata === undefined ? null : { Metadata: v.metadata }), + }; + }); +} + +/** @internal */ +export namespace SearchLibraryResponseBody$ { + export type Inbound = { + MediaContainer?: SearchLibraryMediaContainer$.Inbound | undefined; + }; + + export const inboundSchema: z.ZodType = z + .object({ + MediaContainer: z.lazy(() => SearchLibraryMediaContainer$.inboundSchema).optional(), + }) + .transform((v) => { + return { + ...(v.MediaContainer === undefined ? null : { mediaContainer: v.MediaContainer }), + }; + }); + + export type Outbound = { + MediaContainer?: SearchLibraryMediaContainer$.Outbound | undefined; + }; + + export const outboundSchema: z.ZodType = z + .object({ + mediaContainer: z.lazy(() => SearchLibraryMediaContainer$.outboundSchema).optional(), + }) + .transform((v) => { + return { + ...(v.mediaContainer === undefined ? null : { MediaContainer: v.mediaContainer }), + }; + }); +} + +/** @internal */ +export namespace SearchLibraryResponse$ { + export type Inbound = { + ContentType: string; + StatusCode: number; + RawResponse: Response; + object?: SearchLibraryResponseBody$.Inbound | undefined; + }; + + 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 { + contentType: v.ContentType, + statusCode: v.StatusCode, + rawResponse: v.RawResponse, + ...(v.object === undefined ? null : { object: v.object }), + }; + }); + + 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 { + ContentType: v.contentType, + StatusCode: v.statusCode, + RawResponse: v.rawResponse, + ...(v.object === undefined ? null : { object: v.object }), + }; + }); +} diff --git a/src/sdk/library.ts b/src/sdk/library.ts index a8a85228..3cf49378 100644 --- a/src/sdk/library.ts +++ b/src/sdk/library.ts @@ -436,7 +436,6 @@ export class Library extends ClientSDK { * - `resolution`: Items categorized by resolution. * - `firstCharacter`: Items categorized by the first letter. * - `folder`: Items categorized by folder. - * - `search?type=1`: Search functionality within the section. * */ async getLibraryItems( @@ -584,6 +583,104 @@ export class Library extends ClientSDK { return operations.RefreshLibraryResponse$.inboundSchema.parse(responseFields$); } + /** + * 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. + * + */ + async searchLibrary( + sectionId: number, + type: operations.TypeT, + options?: RequestOptions + ): Promise { + const input$: operations.SearchLibraryRequest = { + sectionId: sectionId, + type: type, + }; + const headers$ = new Headers(); + headers$.set("user-agent", SDK_METADATA.userAgent); + headers$.set("Accept", "application/json"); + + const payload$ = operations.SearchLibraryRequest$.outboundSchema.parse(input$); + const body$ = null; + + const pathParams$ = { + sectionId: enc$.encodeSimple("sectionId", payload$.sectionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path$ = this.templateURLComponent("/library/sections/{sectionId}/search")( + pathParams$ + ); + + const query$ = [ + enc$.encodeForm("type", payload$.type, { explode: true, charEncoding: "percent" }), + ] + .filter(Boolean) + .join("&"); + + 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 securitySettings$ = this.resolveGlobalSecurity(security$); + + const response = await this.fetch$( + { + security: securitySettings$, + method: "GET", + path: path$, + headers: headers$, + query: query$, + body: body$, + }, + options + ); + + const responseFields$ = { + ContentType: response.headers.get("content-type") ?? "application/octet-stream", + StatusCode: response.status, + RawResponse: response, + }; + + if (this.matchResponse(response, 200, "application/json")) { + const responseBody = await response.json(); + const result = operations.SearchLibraryResponse$.inboundSchema.parse({ + ...responseFields$, + object: responseBody, + }); + return result; + } else { + const responseBody = await response.text(); + throw new errors.SDKError("Unexpected API response", response, responseBody); + } + } + /** * Get Items Metadata * diff --git a/src/sdk/security.ts b/src/sdk/security.ts index 5e17e2f3..1b6d4c3c 100644 --- a/src/sdk/security.ts +++ b/src/sdk/security.ts @@ -29,7 +29,7 @@ export class Security extends ClientSDK { * */ async getTransientToken( - type: operations.QueryParamType, + type: operations.GetTransientTokenQueryParamType, scope: operations.Scope, options?: RequestOptions ): Promise {