mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
266 lines
8.0 KiB
TypeScript
266 lines
8.0 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 GetServerIdentityErrors = {
|
|
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 GetServerIdentityServerResponseBodyData = {
|
|
errors?: Array<GetServerIdentityErrors> | 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 GetServerIdentityServerResponseBody extends Error {
|
|
errors?: Array<GetServerIdentityErrors> | undefined;
|
|
/**
|
|
* Raw HTTP response; suitable for custom response parsing
|
|
*/
|
|
rawResponse?: Response | undefined;
|
|
|
|
/** The original data that was passed to this error instance. */
|
|
data$: GetServerIdentityServerResponseBodyData;
|
|
|
|
constructor(err: GetServerIdentityServerResponseBodyData) {
|
|
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 = "GetServerIdentityServerResponseBody";
|
|
}
|
|
}
|
|
|
|
export type GetServerIdentityMediaContainer = {
|
|
size?: number | undefined;
|
|
claimed?: boolean | undefined;
|
|
machineIdentifier?: string | undefined;
|
|
version?: string | undefined;
|
|
};
|
|
|
|
/**
|
|
* The Server Identity information
|
|
*/
|
|
export type GetServerIdentityResponseBody = {
|
|
mediaContainer?: GetServerIdentityMediaContainer | undefined;
|
|
};
|
|
|
|
export type GetServerIdentityResponse = {
|
|
/**
|
|
* 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 Server Identity information
|
|
*/
|
|
object?: GetServerIdentityResponseBody | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export namespace GetServerIdentityErrors$ {
|
|
export const inboundSchema: z.ZodType<GetServerIdentityErrors, 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, GetServerIdentityErrors> =
|
|
z.object({
|
|
code: z.number().optional(),
|
|
message: z.string().optional(),
|
|
status: z.number().optional(),
|
|
});
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetServerIdentityServerResponseBody$ {
|
|
export const inboundSchema: z.ZodType<
|
|
GetServerIdentityServerResponseBody,
|
|
z.ZodTypeDef,
|
|
unknown
|
|
> = z
|
|
.object({
|
|
errors: z.array(z.lazy(() => GetServerIdentityErrors$.inboundSchema)).optional(),
|
|
RawResponse: z.instanceof(Response).optional(),
|
|
})
|
|
.transform((v) => {
|
|
const remapped = remap$(v, {
|
|
RawResponse: "rawResponse",
|
|
});
|
|
|
|
return new GetServerIdentityServerResponseBody(remapped);
|
|
});
|
|
|
|
export type Outbound = {
|
|
errors?: Array<GetServerIdentityErrors$.Outbound> | undefined;
|
|
RawResponse?: never | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<
|
|
Outbound,
|
|
z.ZodTypeDef,
|
|
GetServerIdentityServerResponseBody
|
|
> = z
|
|
.instanceof(GetServerIdentityServerResponseBody)
|
|
.transform((v) => v.data$)
|
|
.pipe(
|
|
z
|
|
.object({
|
|
errors: z
|
|
.array(z.lazy(() => GetServerIdentityErrors$.outboundSchema))
|
|
.optional(),
|
|
rawResponse: z
|
|
.instanceof(Response)
|
|
.transform(() => {
|
|
throw new Error("Response cannot be serialized");
|
|
})
|
|
.optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
rawResponse: "RawResponse",
|
|
});
|
|
})
|
|
);
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetServerIdentityMediaContainer$ {
|
|
export const inboundSchema: z.ZodType<GetServerIdentityMediaContainer, z.ZodTypeDef, unknown> =
|
|
z.object({
|
|
size: z.number().optional(),
|
|
claimed: z.boolean().optional(),
|
|
machineIdentifier: z.string().optional(),
|
|
version: z.string().optional(),
|
|
});
|
|
|
|
export type Outbound = {
|
|
size?: number | undefined;
|
|
claimed?: boolean | undefined;
|
|
machineIdentifier?: string | undefined;
|
|
version?: string | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<
|
|
Outbound,
|
|
z.ZodTypeDef,
|
|
GetServerIdentityMediaContainer
|
|
> = z.object({
|
|
size: z.number().optional(),
|
|
claimed: z.boolean().optional(),
|
|
machineIdentifier: z.string().optional(),
|
|
version: z.string().optional(),
|
|
});
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetServerIdentityResponseBody$ {
|
|
export const inboundSchema: z.ZodType<GetServerIdentityResponseBody, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
MediaContainer: z.lazy(() => GetServerIdentityMediaContainer$.inboundSchema).optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
MediaContainer: "mediaContainer",
|
|
});
|
|
});
|
|
|
|
export type Outbound = {
|
|
MediaContainer?: GetServerIdentityMediaContainer$.Outbound | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetServerIdentityResponseBody> =
|
|
z
|
|
.object({
|
|
mediaContainer: z
|
|
.lazy(() => GetServerIdentityMediaContainer$.outboundSchema)
|
|
.optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
mediaContainer: "MediaContainer",
|
|
});
|
|
});
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace GetServerIdentityResponse$ {
|
|
export const inboundSchema: z.ZodType<GetServerIdentityResponse, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
ContentType: z.string(),
|
|
StatusCode: z.number().int(),
|
|
RawResponse: z.instanceof(Response),
|
|
object: z.lazy(() => GetServerIdentityResponseBody$.inboundSchema).optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
ContentType: "contentType",
|
|
StatusCode: "statusCode",
|
|
RawResponse: "rawResponse",
|
|
});
|
|
});
|
|
|
|
export type Outbound = {
|
|
ContentType: string;
|
|
StatusCode: number;
|
|
RawResponse: never;
|
|
object?: GetServerIdentityResponseBody$.Outbound | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetServerIdentityResponse> = z
|
|
.object({
|
|
contentType: z.string(),
|
|
statusCode: z.number().int(),
|
|
rawResponse: z.instanceof(Response).transform(() => {
|
|
throw new Error("Response cannot be serialized");
|
|
}),
|
|
object: z.lazy(() => GetServerIdentityResponseBody$.outboundSchema).optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
contentType: "ContentType",
|
|
statusCode: "StatusCode",
|
|
rawResponse: "RawResponse",
|
|
});
|
|
});
|
|
}
|