mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-11 04:20:58 +00:00
Normalized imports, regenerated
This commit is contained in:
157
src/sdk/models/errors/getsessions.ts
Normal file
157
src/sdk/models/errors/getsessions.ts
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
import { remap as remap$ } from "../../../lib/primitives.js";
|
||||
import * as z from "zod";
|
||||
|
||||
export type GetSessionsErrors = {
|
||||
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 GetSessionsResponseBodyData = {
|
||||
errors?: Array<GetSessionsErrors> | 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 GetSessionsResponseBody extends Error {
|
||||
errors?: Array<GetSessionsErrors> | undefined;
|
||||
/**
|
||||
* Raw HTTP response; suitable for custom response parsing
|
||||
*/
|
||||
rawResponse?: Response | undefined;
|
||||
|
||||
/** The original data that was passed to this error instance. */
|
||||
data$: GetSessionsResponseBodyData;
|
||||
|
||||
constructor(err: GetSessionsResponseBodyData) {
|
||||
const message =
|
||||
"message" in err && typeof err.message === "string"
|
||||
? err.message
|
||||
: `API error occurred: ${JSON.stringify(err)}`;
|
||||
super(message);
|
||||
this.data$ = err;
|
||||
|
||||
if (err.errors != null) {
|
||||
this.errors = err.errors;
|
||||
}
|
||||
if (err.rawResponse != null) {
|
||||
this.rawResponse = err.rawResponse;
|
||||
}
|
||||
|
||||
this.name = "GetSessionsResponseBody";
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const GetSessionsErrors$inboundSchema: z.ZodType<GetSessionsErrors, z.ZodTypeDef, unknown> =
|
||||
z.object({
|
||||
code: z.number().optional(),
|
||||
message: z.string().optional(),
|
||||
status: z.number().optional(),
|
||||
});
|
||||
|
||||
/** @internal */
|
||||
export type GetSessionsErrors$Outbound = {
|
||||
code?: number | undefined;
|
||||
message?: string | undefined;
|
||||
status?: number | undefined;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const GetSessionsErrors$outboundSchema: z.ZodType<
|
||||
GetSessionsErrors$Outbound,
|
||||
z.ZodTypeDef,
|
||||
GetSessionsErrors
|
||||
> = z.object({
|
||||
code: z.number().optional(),
|
||||
message: z.string().optional(),
|
||||
status: z.number().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
||||
*/
|
||||
export namespace GetSessionsErrors$ {
|
||||
/** @deprecated use `GetSessionsErrors$inboundSchema` instead. */
|
||||
export const inboundSchema = GetSessionsErrors$inboundSchema;
|
||||
/** @deprecated use `GetSessionsErrors$outboundSchema` instead. */
|
||||
export const outboundSchema = GetSessionsErrors$outboundSchema;
|
||||
/** @deprecated use `GetSessionsErrors$Outbound` instead. */
|
||||
export type Outbound = GetSessionsErrors$Outbound;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const GetSessionsResponseBody$inboundSchema: z.ZodType<
|
||||
GetSessionsResponseBody,
|
||||
z.ZodTypeDef,
|
||||
unknown
|
||||
> = z
|
||||
.object({
|
||||
errors: z.array(z.lazy(() => GetSessionsErrors$inboundSchema)).optional(),
|
||||
RawResponse: z.instanceof(Response).optional(),
|
||||
})
|
||||
.transform((v) => {
|
||||
const remapped = remap$(v, {
|
||||
RawResponse: "rawResponse",
|
||||
});
|
||||
|
||||
return new GetSessionsResponseBody(remapped);
|
||||
});
|
||||
|
||||
/** @internal */
|
||||
export type GetSessionsResponseBody$Outbound = {
|
||||
errors?: Array<GetSessionsErrors$Outbound> | undefined;
|
||||
RawResponse?: never | undefined;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const GetSessionsResponseBody$outboundSchema: z.ZodType<
|
||||
GetSessionsResponseBody$Outbound,
|
||||
z.ZodTypeDef,
|
||||
GetSessionsResponseBody
|
||||
> = z
|
||||
.instanceof(GetSessionsResponseBody)
|
||||
.transform((v) => v.data$)
|
||||
.pipe(
|
||||
z
|
||||
.object({
|
||||
errors: z.array(z.lazy(() => GetSessionsErrors$outboundSchema)).optional(),
|
||||
rawResponse: z
|
||||
.instanceof(Response)
|
||||
.transform(() => {
|
||||
throw new Error("Response cannot be serialized");
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.transform((v) => {
|
||||
return remap$(v, {
|
||||
rawResponse: "RawResponse",
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
||||
*/
|
||||
export namespace GetSessionsResponseBody$ {
|
||||
/** @deprecated use `GetSessionsResponseBody$inboundSchema` instead. */
|
||||
export const inboundSchema = GetSessionsResponseBody$inboundSchema;
|
||||
/** @deprecated use `GetSessionsResponseBody$outboundSchema` instead. */
|
||||
export const outboundSchema = GetSessionsResponseBody$outboundSchema;
|
||||
/** @deprecated use `GetSessionsResponseBody$Outbound` instead. */
|
||||
export type Outbound = GetSessionsResponseBody$Outbound;
|
||||
}
|
||||
Reference in New Issue
Block a user