Compare commits

...

1 Commits

Author SHA1 Message Date
speakeasybot
e9cfd11a9c ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.150.0 2024-01-23 20:48:45 +00:00
28 changed files with 813 additions and 76 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -129,3 +129,13 @@ Based on:
- [typescript v0.5.1] .
### Releases
- [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 - .

View File

@@ -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 |
| 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 |

View File

@@ -0,0 +1,10 @@
# GetTransientTokenQueryParamType
`delegation` - This is the only supported `type` parameter.
## Values
| Name | Value |
| ------------ | ------------ |
| `Delegation` | delegation |

View File

@@ -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. |
| 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. |

View File

@@ -1,10 +1,12 @@
# QueryParamType
`delegation` - This is the only supported `type` parameter.
type of playlist to create
## Values
| Name | Value |
| ------------ | ------------ |
| `Delegation` | delegation |
| Name | Value |
| ------- | ------- |
| `Audio` | audio |
| `Video` | video |
| `Photo` | photo |

File diff suppressed because one or more lines are too long

View File

@@ -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 |

View File

@@ -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 |

View File

@@ -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 |

View File

@@ -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 |

View File

@@ -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 |
| 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 |

View File

@@ -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 |
| `One` | 1 |
| `Two` | 2 |
| `Three` | 3 |
| `Four` | 4 |

View File

@@ -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: "<YOUR_API_KEY_HERE>",
});
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.

View File

@@ -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",
});

View File

@@ -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: "<YOUR_API_KEY_HERE>",
});
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. |

View File

@@ -8,7 +8,7 @@ generation:
fixes:
nameResolutionDec2023: false
typescript:
version: 0.5.1
version: 0.5.2
author: LukeHagar
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true

4
package-lock.json generated
View File

@@ -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"

View File

@@ -1,7 +1,7 @@
{
"type": "commonjs",
"name": "@lukehagar/plexjs",
"version": "0.5.1",
"version": "0.5.2",
"author": "LukeHagar",
"main": "./index.js",
"sideEffects": false,

View File

@@ -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",
});

View File

@@ -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<CreatePlaylistRequest, z.ZodTypeDef, Inbound> = 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<Outbound, z.ZodTypeDef, CreatePlaylistRequest> = z
.object({
title: z.string(),
type: TypeT$,
type: QueryParamType$,
smart: Smart$,
uri: z.string(),
playQueueID: z.number().optional(),

View File

@@ -28,7 +28,6 @@ export enum Tag {
Resolution = "resolution",
FirstCharacter = "firstCharacter",
Folder = "folder",
SearchTypeEqual1 = "search?type=1",
}
export type GetLibraryItemsRequest = {

View File

@@ -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<GetTransientTokenRequest, z.ZodTypeDef, Inbound> = 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<Outbound, z.ZodTypeDef, GetTransientTokenRequest> = z
.object({
type: QueryParamType$,
type: GetTransientTokenQueryParamType$,
scope: Scope$,
})
.transform((v) => {

View File

@@ -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";

View File

@@ -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<SearchLibraryMetadata> | 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<SearchLibraryRequest, z.ZodTypeDef, Inbound> = 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<Outbound, z.ZodTypeDef, SearchLibraryRequest> = 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<SearchLibraryMetadata, z.ZodTypeDef, Inbound> = 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<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(),
})
.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<SearchLibraryMetadata$.Inbound> | undefined;
};
export const inboundSchema: z.ZodType<SearchLibraryMediaContainer, z.ZodTypeDef, Inbound> = 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<SearchLibraryMetadata$.Outbound> | undefined;
};
export const outboundSchema: z.ZodType<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 {
...(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<SearchLibraryResponseBody, z.ZodTypeDef, Inbound> = 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<Outbound, z.ZodTypeDef, SearchLibraryResponseBody> = 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<SearchLibraryResponse, z.ZodTypeDef, Inbound> = 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<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 {
ContentType: v.contentType,
StatusCode: v.statusCode,
RawResponse: v.rawResponse,
...(v.object === undefined ? null : { object: v.object }),
};
});
}

View File

@@ -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<operations.SearchLibraryResponse> {
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
*

View File

@@ -29,7 +29,7 @@ export class Security extends ClientSDK {
*
*/
async getTransientToken(
type: operations.QueryParamType,
type: operations.GetTransientTokenQueryParamType,
scope: operations.Scope,
options?: RequestOptions
): Promise<operations.GetTransientTokenResponse> {