Files
plexjs/src/models/getsearchresultsop.ts

756 lines
25 KiB
TypeScript

/*
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/
import { remap as remap$ } from "../lib/primitives.js";
import * as z from "zod";
export type GetSearchResultsRequest = {
/**
* The search query string to use
*/
query: string;
};
export type GetSearchResultsErrors = {
code?: number | undefined;
message?: string | undefined;
status?: number | undefined;
};
/**
* Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
*/
export type GetSearchResultsSearchResponseBodyData = {
errors?: Array<GetSearchResultsErrors> | undefined;
/**
* Raw HTTP response; suitable for custom response parsing
*/
rawResponse?: Response | undefined;
};
/**
* Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
*/
export class GetSearchResultsSearchResponseBody extends Error {
errors?: Array<GetSearchResultsErrors> | undefined;
/**
* Raw HTTP response; suitable for custom response parsing
*/
rawResponse?: Response | undefined;
/** The original data that was passed to this error instance. */
data$: GetSearchResultsSearchResponseBodyData;
constructor(err: GetSearchResultsSearchResponseBodyData) {
super("");
this.data$ = err;
if (err.errors != null) {
this.errors = err.errors;
}
if (err.rawResponse != null) {
this.rawResponse = err.rawResponse;
}
this.message =
"message" in err && typeof err.message === "string"
? err.message
: "API error occurred";
this.name = "GetSearchResultsSearchResponseBody";
}
}
export type GetSearchResultsPart = {
id?: number | undefined;
key?: string | undefined;
duration?: number | undefined;
file?: string | undefined;
size?: number | undefined;
audioProfile?: string | undefined;
container?: string | undefined;
videoProfile?: string | undefined;
};
export type GetSearchResultsMedia = {
id?: number | undefined;
duration?: number | undefined;
bitrate?: number | undefined;
width?: number | undefined;
height?: number | undefined;
aspectRatio?: number | undefined;
audioChannels?: number | undefined;
audioCodec?: string | undefined;
videoCodec?: string | undefined;
videoResolution?: number | undefined;
container?: string | undefined;
videoFrameRate?: string | undefined;
audioProfile?: string | undefined;
videoProfile?: string | undefined;
part?: Array<GetSearchResultsPart> | undefined;
};
export type GetSearchResultsGenre = {
tag?: string | undefined;
};
export type GetSearchResultsDirector = {
tag?: string | undefined;
};
export type GetSearchResultsWriter = {
tag?: string | undefined;
};
export type GetSearchResultsCountry = {
tag?: string | undefined;
};
export type GetSearchResultsRole = {
tag?: string | undefined;
};
export type GetSearchResultsMetadata = {
allowSync?: boolean | undefined;
librarySectionID?: number | undefined;
librarySectionTitle?: string | undefined;
librarySectionUUID?: string | undefined;
personal?: boolean | undefined;
sourceTitle?: string | undefined;
ratingKey?: number | undefined;
key?: string | undefined;
guid?: string | undefined;
studio?: string | undefined;
type?: string | undefined;
title?: string | undefined;
contentRating?: string | undefined;
summary?: string | undefined;
rating?: number | undefined;
audienceRating?: number | undefined;
year?: number | undefined;
tagline?: string | undefined;
thumb?: string | undefined;
art?: string | undefined;
duration?: number | undefined;
originallyAvailableAt?: Date | undefined;
addedAt?: number | undefined;
updatedAt?: number | undefined;
audienceRatingImage?: string | undefined;
chapterSource?: string | undefined;
primaryExtraKey?: string | undefined;
ratingImage?: string | undefined;
media?: Array<GetSearchResultsMedia> | undefined;
genre?: Array<GetSearchResultsGenre> | undefined;
director?: Array<GetSearchResultsDirector> | undefined;
writer?: Array<GetSearchResultsWriter> | undefined;
country?: Array<GetSearchResultsCountry> | undefined;
role?: Array<GetSearchResultsRole> | undefined;
};
export type Provider = {
key?: string | undefined;
title?: string | undefined;
type?: string | undefined;
};
export type GetSearchResultsMediaContainer = {
size?: number | undefined;
identifier?: string | undefined;
mediaTagPrefix?: string | undefined;
mediaTagVersion?: number | undefined;
metadata?: Array<GetSearchResultsMetadata> | undefined;
provider?: Array<Provider> | undefined;
};
/**
* Search Results
*/
export type GetSearchResultsResponseBody = {
mediaContainer?: GetSearchResultsMediaContainer | undefined;
};
export type GetSearchResultsResponse = {
/**
* 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;
/**
* Search Results
*/
object?: GetSearchResultsResponseBody | undefined;
};
/** @internal */
export namespace GetSearchResultsRequest$ {
export const inboundSchema: z.ZodType<GetSearchResultsRequest, z.ZodTypeDef, unknown> =
z.object({
query: z.string(),
});
export type Outbound = {
query: string;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsRequest> =
z.object({
query: z.string(),
});
}
/** @internal */
export namespace GetSearchResultsErrors$ {
export const inboundSchema: z.ZodType<GetSearchResultsErrors, z.ZodTypeDef, unknown> = z.object(
{
code: z.number().optional(),
message: z.string().optional(),
status: z.number().optional(),
}
);
export type Outbound = {
code?: number | undefined;
message?: string | undefined;
status?: number | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsErrors> =
z.object({
code: z.number().optional(),
message: z.string().optional(),
status: z.number().optional(),
});
}
/** @internal */
export namespace GetSearchResultsSearchResponseBody$ {
export const inboundSchema: z.ZodType<
GetSearchResultsSearchResponseBody,
z.ZodTypeDef,
unknown
> = z
.object({
errors: z.array(z.lazy(() => GetSearchResultsErrors$.inboundSchema)).optional(),
RawResponse: z.instanceof(Response).optional(),
})
.transform((v) => {
const remapped = remap$(v, {
RawResponse: "rawResponse",
});
return new GetSearchResultsSearchResponseBody(remapped);
});
export type Outbound = {
errors?: Array<GetSearchResultsErrors$.Outbound> | undefined;
RawResponse?: never | undefined;
};
export const outboundSchema: z.ZodType<
Outbound,
z.ZodTypeDef,
GetSearchResultsSearchResponseBody
> = z
.instanceof(GetSearchResultsSearchResponseBody)
.transform((v) => v.data$)
.pipe(
z
.object({
errors: z
.array(z.lazy(() => GetSearchResultsErrors$.outboundSchema))
.optional(),
rawResponse: z
.instanceof(Response)
.transform(() => {
throw new Error("Response cannot be serialized");
})
.optional(),
})
.transform((v) => {
return remap$(v, {
rawResponse: "RawResponse",
});
})
);
}
/** @internal */
export namespace GetSearchResultsPart$ {
export const inboundSchema: z.ZodType<GetSearchResultsPart, z.ZodTypeDef, unknown> = z.object({
id: z.number().optional(),
key: z.string().optional(),
duration: z.number().optional(),
file: z.string().optional(),
size: z.number().optional(),
audioProfile: z.string().optional(),
container: z.string().optional(),
videoProfile: z.string().optional(),
});
export type Outbound = {
id?: number | undefined;
key?: string | undefined;
duration?: number | undefined;
file?: string | undefined;
size?: number | undefined;
audioProfile?: string | undefined;
container?: string | undefined;
videoProfile?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsPart> = z.object(
{
id: z.number().optional(),
key: z.string().optional(),
duration: z.number().optional(),
file: z.string().optional(),
size: z.number().optional(),
audioProfile: z.string().optional(),
container: z.string().optional(),
videoProfile: z.string().optional(),
}
);
}
/** @internal */
export namespace GetSearchResultsMedia$ {
export const inboundSchema: z.ZodType<GetSearchResultsMedia, z.ZodTypeDef, unknown> = z
.object({
id: z.number().optional(),
duration: z.number().optional(),
bitrate: z.number().optional(),
width: z.number().optional(),
height: z.number().optional(),
aspectRatio: z.number().optional(),
audioChannels: z.number().optional(),
audioCodec: z.string().optional(),
videoCodec: z.string().optional(),
videoResolution: z.number().optional(),
container: z.string().optional(),
videoFrameRate: z.string().optional(),
audioProfile: z.string().optional(),
videoProfile: z.string().optional(),
Part: z.array(z.lazy(() => GetSearchResultsPart$.inboundSchema)).optional(),
})
.transform((v) => {
return remap$(v, {
Part: "part",
});
});
export type Outbound = {
id?: number | undefined;
duration?: number | undefined;
bitrate?: number | undefined;
width?: number | undefined;
height?: number | undefined;
aspectRatio?: number | undefined;
audioChannels?: number | undefined;
audioCodec?: string | undefined;
videoCodec?: string | undefined;
videoResolution?: number | undefined;
container?: string | undefined;
videoFrameRate?: string | undefined;
audioProfile?: string | undefined;
videoProfile?: string | undefined;
Part?: Array<GetSearchResultsPart$.Outbound> | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsMedia> = z
.object({
id: z.number().optional(),
duration: z.number().optional(),
bitrate: z.number().optional(),
width: z.number().optional(),
height: z.number().optional(),
aspectRatio: z.number().optional(),
audioChannels: z.number().optional(),
audioCodec: z.string().optional(),
videoCodec: z.string().optional(),
videoResolution: z.number().optional(),
container: z.string().optional(),
videoFrameRate: z.string().optional(),
audioProfile: z.string().optional(),
videoProfile: z.string().optional(),
part: z.array(z.lazy(() => GetSearchResultsPart$.outboundSchema)).optional(),
})
.transform((v) => {
return remap$(v, {
part: "Part",
});
});
}
/** @internal */
export namespace GetSearchResultsGenre$ {
export const inboundSchema: z.ZodType<GetSearchResultsGenre, z.ZodTypeDef, unknown> = z.object({
tag: z.string().optional(),
});
export type Outbound = {
tag?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsGenre> =
z.object({
tag: z.string().optional(),
});
}
/** @internal */
export namespace GetSearchResultsDirector$ {
export const inboundSchema: z.ZodType<GetSearchResultsDirector, z.ZodTypeDef, unknown> =
z.object({
tag: z.string().optional(),
});
export type Outbound = {
tag?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsDirector> =
z.object({
tag: z.string().optional(),
});
}
/** @internal */
export namespace GetSearchResultsWriter$ {
export const inboundSchema: z.ZodType<GetSearchResultsWriter, z.ZodTypeDef, unknown> = z.object(
{
tag: z.string().optional(),
}
);
export type Outbound = {
tag?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsWriter> =
z.object({
tag: z.string().optional(),
});
}
/** @internal */
export namespace GetSearchResultsCountry$ {
export const inboundSchema: z.ZodType<GetSearchResultsCountry, z.ZodTypeDef, unknown> =
z.object({
tag: z.string().optional(),
});
export type Outbound = {
tag?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsCountry> =
z.object({
tag: z.string().optional(),
});
}
/** @internal */
export namespace GetSearchResultsRole$ {
export const inboundSchema: z.ZodType<GetSearchResultsRole, z.ZodTypeDef, unknown> = z.object({
tag: z.string().optional(),
});
export type Outbound = {
tag?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsRole> = z.object(
{
tag: z.string().optional(),
}
);
}
/** @internal */
export namespace GetSearchResultsMetadata$ {
export const inboundSchema: z.ZodType<GetSearchResultsMetadata, z.ZodTypeDef, unknown> = z
.object({
allowSync: z.boolean().optional(),
librarySectionID: z.number().optional(),
librarySectionTitle: z.string().optional(),
librarySectionUUID: z.string().optional(),
personal: z.boolean().optional(),
sourceTitle: z.string().optional(),
ratingKey: z.number().optional(),
key: z.string().optional(),
guid: z.string().optional(),
studio: z.string().optional(),
type: z.string().optional(),
title: z.string().optional(),
contentRating: z.string().optional(),
summary: z.string().optional(),
rating: z.number().optional(),
audienceRating: z.number().optional(),
year: z.number().optional(),
tagline: z.string().optional(),
thumb: z.string().optional(),
art: z.string().optional(),
duration: z.number().optional(),
originallyAvailableAt: z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v))
.optional(),
addedAt: z.number().optional(),
updatedAt: z.number().optional(),
audienceRatingImage: z.string().optional(),
chapterSource: z.string().optional(),
primaryExtraKey: z.string().optional(),
ratingImage: z.string().optional(),
Media: z.array(z.lazy(() => GetSearchResultsMedia$.inboundSchema)).optional(),
Genre: z.array(z.lazy(() => GetSearchResultsGenre$.inboundSchema)).optional(),
Director: z.array(z.lazy(() => GetSearchResultsDirector$.inboundSchema)).optional(),
Writer: z.array(z.lazy(() => GetSearchResultsWriter$.inboundSchema)).optional(),
Country: z.array(z.lazy(() => GetSearchResultsCountry$.inboundSchema)).optional(),
Role: z.array(z.lazy(() => GetSearchResultsRole$.inboundSchema)).optional(),
})
.transform((v) => {
return remap$(v, {
Media: "media",
Genre: "genre",
Director: "director",
Writer: "writer",
Country: "country",
Role: "role",
});
});
export type Outbound = {
allowSync?: boolean | undefined;
librarySectionID?: number | undefined;
librarySectionTitle?: string | undefined;
librarySectionUUID?: string | undefined;
personal?: boolean | undefined;
sourceTitle?: string | undefined;
ratingKey?: number | undefined;
key?: string | undefined;
guid?: string | undefined;
studio?: string | undefined;
type?: string | undefined;
title?: string | undefined;
contentRating?: string | undefined;
summary?: string | undefined;
rating?: number | undefined;
audienceRating?: number | undefined;
year?: number | undefined;
tagline?: string | undefined;
thumb?: string | undefined;
art?: string | undefined;
duration?: number | undefined;
originallyAvailableAt?: string | undefined;
addedAt?: number | undefined;
updatedAt?: number | undefined;
audienceRatingImage?: string | undefined;
chapterSource?: string | undefined;
primaryExtraKey?: string | undefined;
ratingImage?: string | undefined;
Media?: Array<GetSearchResultsMedia$.Outbound> | undefined;
Genre?: Array<GetSearchResultsGenre$.Outbound> | undefined;
Director?: Array<GetSearchResultsDirector$.Outbound> | undefined;
Writer?: Array<GetSearchResultsWriter$.Outbound> | undefined;
Country?: Array<GetSearchResultsCountry$.Outbound> | undefined;
Role?: Array<GetSearchResultsRole$.Outbound> | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsMetadata> = z
.object({
allowSync: z.boolean().optional(),
librarySectionID: z.number().optional(),
librarySectionTitle: z.string().optional(),
librarySectionUUID: z.string().optional(),
personal: z.boolean().optional(),
sourceTitle: z.string().optional(),
ratingKey: z.number().optional(),
key: z.string().optional(),
guid: z.string().optional(),
studio: z.string().optional(),
type: z.string().optional(),
title: z.string().optional(),
contentRating: z.string().optional(),
summary: z.string().optional(),
rating: z.number().optional(),
audienceRating: z.number().optional(),
year: z.number().optional(),
tagline: z.string().optional(),
thumb: z.string().optional(),
art: z.string().optional(),
duration: z.number().optional(),
originallyAvailableAt: z
.date()
.transform((v) => v.toISOString())
.optional(),
addedAt: z.number().optional(),
updatedAt: z.number().optional(),
audienceRatingImage: z.string().optional(),
chapterSource: z.string().optional(),
primaryExtraKey: z.string().optional(),
ratingImage: z.string().optional(),
media: z.array(z.lazy(() => GetSearchResultsMedia$.outboundSchema)).optional(),
genre: z.array(z.lazy(() => GetSearchResultsGenre$.outboundSchema)).optional(),
director: z.array(z.lazy(() => GetSearchResultsDirector$.outboundSchema)).optional(),
writer: z.array(z.lazy(() => GetSearchResultsWriter$.outboundSchema)).optional(),
country: z.array(z.lazy(() => GetSearchResultsCountry$.outboundSchema)).optional(),
role: z.array(z.lazy(() => GetSearchResultsRole$.outboundSchema)).optional(),
})
.transform((v) => {
return remap$(v, {
media: "Media",
genre: "Genre",
director: "Director",
writer: "Writer",
country: "Country",
role: "Role",
});
});
}
/** @internal */
export namespace Provider$ {
export const inboundSchema: z.ZodType<Provider, z.ZodTypeDef, unknown> = z.object({
key: z.string().optional(),
title: z.string().optional(),
type: z.string().optional(),
});
export type Outbound = {
key?: string | undefined;
title?: string | undefined;
type?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Provider> = z.object({
key: z.string().optional(),
title: z.string().optional(),
type: z.string().optional(),
});
}
/** @internal */
export namespace GetSearchResultsMediaContainer$ {
export const inboundSchema: z.ZodType<GetSearchResultsMediaContainer, z.ZodTypeDef, unknown> = z
.object({
size: z.number().optional(),
identifier: z.string().optional(),
mediaTagPrefix: z.string().optional(),
mediaTagVersion: z.number().optional(),
Metadata: z.array(z.lazy(() => GetSearchResultsMetadata$.inboundSchema)).optional(),
Provider: z.array(z.lazy(() => Provider$.inboundSchema)).optional(),
})
.transform((v) => {
return remap$(v, {
Metadata: "metadata",
Provider: "provider",
});
});
export type Outbound = {
size?: number | undefined;
identifier?: string | undefined;
mediaTagPrefix?: string | undefined;
mediaTagVersion?: number | undefined;
Metadata?: Array<GetSearchResultsMetadata$.Outbound> | undefined;
Provider?: Array<Provider$.Outbound> | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsMediaContainer> =
z
.object({
size: z.number().optional(),
identifier: z.string().optional(),
mediaTagPrefix: z.string().optional(),
mediaTagVersion: z.number().optional(),
metadata: z
.array(z.lazy(() => GetSearchResultsMetadata$.outboundSchema))
.optional(),
provider: z.array(z.lazy(() => Provider$.outboundSchema)).optional(),
})
.transform((v) => {
return remap$(v, {
metadata: "Metadata",
provider: "Provider",
});
});
}
/** @internal */
export namespace GetSearchResultsResponseBody$ {
export const inboundSchema: z.ZodType<GetSearchResultsResponseBody, z.ZodTypeDef, unknown> = z
.object({
MediaContainer: z.lazy(() => GetSearchResultsMediaContainer$.inboundSchema).optional(),
})
.transform((v) => {
return remap$(v, {
MediaContainer: "mediaContainer",
});
});
export type Outbound = {
MediaContainer?: GetSearchResultsMediaContainer$.Outbound | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsResponseBody> = z
.object({
mediaContainer: z.lazy(() => GetSearchResultsMediaContainer$.outboundSchema).optional(),
})
.transform((v) => {
return remap$(v, {
mediaContainer: "MediaContainer",
});
});
}
/** @internal */
export namespace GetSearchResultsResponse$ {
export const inboundSchema: z.ZodType<GetSearchResultsResponse, z.ZodTypeDef, unknown> = z
.object({
ContentType: z.string(),
StatusCode: z.number().int(),
RawResponse: z.instanceof(Response),
object: z.lazy(() => GetSearchResultsResponseBody$.inboundSchema).optional(),
})
.transform((v) => {
return remap$(v, {
ContentType: "contentType",
StatusCode: "statusCode",
RawResponse: "rawResponse",
});
});
export type Outbound = {
ContentType: string;
StatusCode: number;
RawResponse: never;
object?: GetSearchResultsResponseBody$.Outbound | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetSearchResultsResponse> = z
.object({
contentType: z.string(),
statusCode: z.number().int(),
rawResponse: z.instanceof(Response).transform(() => {
throw new Error("Response cannot be serialized");
}),
object: z.lazy(() => GetSearchResultsResponseBody$.outboundSchema).optional(),
})
.transform((v) => {
return remap$(v, {
contentType: "ContentType",
statusCode: "StatusCode",
rawResponse: "RawResponse",
});
});
}