mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-07 20:47:49 +00:00
342 lines
10 KiB
TypeScript
342 lines
10 KiB
TypeScript
/*
|
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
*/
|
|
|
|
import * as z from "zod";
|
|
import { remap as remap$ } from "../../../lib/primitives.js";
|
|
import { safeParse } from "../../../lib/schemas.js";
|
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
import { PlexAPIError } from "./plexapierror.js";
|
|
import { SDKValidationError } from "./sdkvalidationerror.js";
|
|
|
|
export type StopAllTasksButlerErrors = {
|
|
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 StopAllTasksUnauthorizedData = {
|
|
errors?: Array<StopAllTasksButlerErrors> | 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 StopAllTasksUnauthorized extends PlexAPIError {
|
|
errors?: Array<StopAllTasksButlerErrors> | undefined;
|
|
|
|
/** The original data that was passed to this error instance. */
|
|
data$: StopAllTasksUnauthorizedData;
|
|
|
|
constructor(
|
|
err: StopAllTasksUnauthorizedData,
|
|
httpMeta: { response: Response; request: Request; body: string },
|
|
) {
|
|
const message = "message" in err && typeof err.message === "string"
|
|
? err.message
|
|
: `API error occurred: ${JSON.stringify(err)}`;
|
|
super(message, httpMeta);
|
|
this.data$ = err;
|
|
if (err.errors != null) this.errors = err.errors;
|
|
|
|
this.name = "StopAllTasksUnauthorized";
|
|
}
|
|
}
|
|
|
|
export type StopAllTasksErrors = {
|
|
code?: number | undefined;
|
|
message?: string | undefined;
|
|
status?: number | undefined;
|
|
};
|
|
|
|
/**
|
|
* Bad Request - A parameter was not specified, or was specified incorrectly.
|
|
*/
|
|
export type StopAllTasksBadRequestData = {
|
|
errors?: Array<StopAllTasksErrors> | undefined;
|
|
/**
|
|
* Raw HTTP response; suitable for custom response parsing
|
|
*/
|
|
rawResponse?: Response | undefined;
|
|
};
|
|
|
|
/**
|
|
* Bad Request - A parameter was not specified, or was specified incorrectly.
|
|
*/
|
|
export class StopAllTasksBadRequest extends PlexAPIError {
|
|
errors?: Array<StopAllTasksErrors> | undefined;
|
|
|
|
/** The original data that was passed to this error instance. */
|
|
data$: StopAllTasksBadRequestData;
|
|
|
|
constructor(
|
|
err: StopAllTasksBadRequestData,
|
|
httpMeta: { response: Response; request: Request; body: string },
|
|
) {
|
|
const message = "message" in err && typeof err.message === "string"
|
|
? err.message
|
|
: `API error occurred: ${JSON.stringify(err)}`;
|
|
super(message, httpMeta);
|
|
this.data$ = err;
|
|
if (err.errors != null) this.errors = err.errors;
|
|
|
|
this.name = "StopAllTasksBadRequest";
|
|
}
|
|
}
|
|
|
|
/** @internal */
|
|
export const StopAllTasksButlerErrors$inboundSchema: z.ZodType<
|
|
StopAllTasksButlerErrors,
|
|
z.ZodTypeDef,
|
|
unknown
|
|
> = z.object({
|
|
code: z.number().int().optional(),
|
|
message: z.string().optional(),
|
|
status: z.number().int().optional(),
|
|
});
|
|
|
|
/** @internal */
|
|
export type StopAllTasksButlerErrors$Outbound = {
|
|
code?: number | undefined;
|
|
message?: string | undefined;
|
|
status?: number | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const StopAllTasksButlerErrors$outboundSchema: z.ZodType<
|
|
StopAllTasksButlerErrors$Outbound,
|
|
z.ZodTypeDef,
|
|
StopAllTasksButlerErrors
|
|
> = z.object({
|
|
code: z.number().int().optional(),
|
|
message: z.string().optional(),
|
|
status: z.number().int().optional(),
|
|
});
|
|
|
|
/**
|
|
* @internal
|
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
*/
|
|
export namespace StopAllTasksButlerErrors$ {
|
|
/** @deprecated use `StopAllTasksButlerErrors$inboundSchema` instead. */
|
|
export const inboundSchema = StopAllTasksButlerErrors$inboundSchema;
|
|
/** @deprecated use `StopAllTasksButlerErrors$outboundSchema` instead. */
|
|
export const outboundSchema = StopAllTasksButlerErrors$outboundSchema;
|
|
/** @deprecated use `StopAllTasksButlerErrors$Outbound` instead. */
|
|
export type Outbound = StopAllTasksButlerErrors$Outbound;
|
|
}
|
|
|
|
export function stopAllTasksButlerErrorsToJSON(
|
|
stopAllTasksButlerErrors: StopAllTasksButlerErrors,
|
|
): string {
|
|
return JSON.stringify(
|
|
StopAllTasksButlerErrors$outboundSchema.parse(stopAllTasksButlerErrors),
|
|
);
|
|
}
|
|
|
|
export function stopAllTasksButlerErrorsFromJSON(
|
|
jsonString: string,
|
|
): SafeParseResult<StopAllTasksButlerErrors, SDKValidationError> {
|
|
return safeParse(
|
|
jsonString,
|
|
(x) => StopAllTasksButlerErrors$inboundSchema.parse(JSON.parse(x)),
|
|
`Failed to parse 'StopAllTasksButlerErrors' from JSON`,
|
|
);
|
|
}
|
|
|
|
/** @internal */
|
|
export const StopAllTasksUnauthorized$inboundSchema: z.ZodType<
|
|
StopAllTasksUnauthorized,
|
|
z.ZodTypeDef,
|
|
unknown
|
|
> = z.object({
|
|
errors: z.array(z.lazy(() => StopAllTasksButlerErrors$inboundSchema))
|
|
.optional(),
|
|
RawResponse: z.instanceof(Response).optional(),
|
|
request$: z.instanceof(Request),
|
|
response$: z.instanceof(Response),
|
|
body$: z.string(),
|
|
})
|
|
.transform((v) => {
|
|
const remapped = remap$(v, {
|
|
"RawResponse": "rawResponse",
|
|
});
|
|
|
|
return new StopAllTasksUnauthorized(remapped, {
|
|
request: v.request$,
|
|
response: v.response$,
|
|
body: v.body$,
|
|
});
|
|
});
|
|
|
|
/** @internal */
|
|
export type StopAllTasksUnauthorized$Outbound = {
|
|
errors?: Array<StopAllTasksButlerErrors$Outbound> | undefined;
|
|
RawResponse?: never | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const StopAllTasksUnauthorized$outboundSchema: z.ZodType<
|
|
StopAllTasksUnauthorized$Outbound,
|
|
z.ZodTypeDef,
|
|
StopAllTasksUnauthorized
|
|
> = z.instanceof(StopAllTasksUnauthorized)
|
|
.transform(v => v.data$)
|
|
.pipe(
|
|
z.object({
|
|
errors: z.array(z.lazy(() => StopAllTasksButlerErrors$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 StopAllTasksUnauthorized$ {
|
|
/** @deprecated use `StopAllTasksUnauthorized$inboundSchema` instead. */
|
|
export const inboundSchema = StopAllTasksUnauthorized$inboundSchema;
|
|
/** @deprecated use `StopAllTasksUnauthorized$outboundSchema` instead. */
|
|
export const outboundSchema = StopAllTasksUnauthorized$outboundSchema;
|
|
/** @deprecated use `StopAllTasksUnauthorized$Outbound` instead. */
|
|
export type Outbound = StopAllTasksUnauthorized$Outbound;
|
|
}
|
|
|
|
/** @internal */
|
|
export const StopAllTasksErrors$inboundSchema: z.ZodType<
|
|
StopAllTasksErrors,
|
|
z.ZodTypeDef,
|
|
unknown
|
|
> = z.object({
|
|
code: z.number().int().optional(),
|
|
message: z.string().optional(),
|
|
status: z.number().int().optional(),
|
|
});
|
|
|
|
/** @internal */
|
|
export type StopAllTasksErrors$Outbound = {
|
|
code?: number | undefined;
|
|
message?: string | undefined;
|
|
status?: number | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const StopAllTasksErrors$outboundSchema: z.ZodType<
|
|
StopAllTasksErrors$Outbound,
|
|
z.ZodTypeDef,
|
|
StopAllTasksErrors
|
|
> = z.object({
|
|
code: z.number().int().optional(),
|
|
message: z.string().optional(),
|
|
status: z.number().int().optional(),
|
|
});
|
|
|
|
/**
|
|
* @internal
|
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
*/
|
|
export namespace StopAllTasksErrors$ {
|
|
/** @deprecated use `StopAllTasksErrors$inboundSchema` instead. */
|
|
export const inboundSchema = StopAllTasksErrors$inboundSchema;
|
|
/** @deprecated use `StopAllTasksErrors$outboundSchema` instead. */
|
|
export const outboundSchema = StopAllTasksErrors$outboundSchema;
|
|
/** @deprecated use `StopAllTasksErrors$Outbound` instead. */
|
|
export type Outbound = StopAllTasksErrors$Outbound;
|
|
}
|
|
|
|
export function stopAllTasksErrorsToJSON(
|
|
stopAllTasksErrors: StopAllTasksErrors,
|
|
): string {
|
|
return JSON.stringify(
|
|
StopAllTasksErrors$outboundSchema.parse(stopAllTasksErrors),
|
|
);
|
|
}
|
|
|
|
export function stopAllTasksErrorsFromJSON(
|
|
jsonString: string,
|
|
): SafeParseResult<StopAllTasksErrors, SDKValidationError> {
|
|
return safeParse(
|
|
jsonString,
|
|
(x) => StopAllTasksErrors$inboundSchema.parse(JSON.parse(x)),
|
|
`Failed to parse 'StopAllTasksErrors' from JSON`,
|
|
);
|
|
}
|
|
|
|
/** @internal */
|
|
export const StopAllTasksBadRequest$inboundSchema: z.ZodType<
|
|
StopAllTasksBadRequest,
|
|
z.ZodTypeDef,
|
|
unknown
|
|
> = z.object({
|
|
errors: z.array(z.lazy(() => StopAllTasksErrors$inboundSchema)).optional(),
|
|
RawResponse: z.instanceof(Response).optional(),
|
|
request$: z.instanceof(Request),
|
|
response$: z.instanceof(Response),
|
|
body$: z.string(),
|
|
})
|
|
.transform((v) => {
|
|
const remapped = remap$(v, {
|
|
"RawResponse": "rawResponse",
|
|
});
|
|
|
|
return new StopAllTasksBadRequest(remapped, {
|
|
request: v.request$,
|
|
response: v.response$,
|
|
body: v.body$,
|
|
});
|
|
});
|
|
|
|
/** @internal */
|
|
export type StopAllTasksBadRequest$Outbound = {
|
|
errors?: Array<StopAllTasksErrors$Outbound> | undefined;
|
|
RawResponse?: never | undefined;
|
|
};
|
|
|
|
/** @internal */
|
|
export const StopAllTasksBadRequest$outboundSchema: z.ZodType<
|
|
StopAllTasksBadRequest$Outbound,
|
|
z.ZodTypeDef,
|
|
StopAllTasksBadRequest
|
|
> = z.instanceof(StopAllTasksBadRequest)
|
|
.transform(v => v.data$)
|
|
.pipe(
|
|
z.object({
|
|
errors: z.array(z.lazy(() => StopAllTasksErrors$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 StopAllTasksBadRequest$ {
|
|
/** @deprecated use `StopAllTasksBadRequest$inboundSchema` instead. */
|
|
export const inboundSchema = StopAllTasksBadRequest$inboundSchema;
|
|
/** @deprecated use `StopAllTasksBadRequest$outboundSchema` instead. */
|
|
export const outboundSchema = StopAllTasksBadRequest$outboundSchema;
|
|
/** @deprecated use `StopAllTasksBadRequest$Outbound` instead. */
|
|
export type Outbound = StopAllTasksBadRequest$Outbound;
|
|
}
|