Files
plexjs/src/sdk/models/operations/applyupdates.ts

222 lines
6.4 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
*/
export enum Tonight {
Zero = 0,
One = 1,
}
/**
* Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`.
*/
export enum Skip {
Zero = 0,
One = 1,
}
export type ApplyUpdatesRequest = {
/**
* Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
*/
tonight?: Tonight | undefined;
/**
* Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`.
*/
skip?: Skip | undefined;
};
export type ApplyUpdatesResponse = {
/**
* 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;
};
/** @internal */
export const Tonight$inboundSchema: z.ZodNativeEnum<typeof Tonight> = z
.nativeEnum(Tonight);
/** @internal */
export const Tonight$outboundSchema: z.ZodNativeEnum<typeof Tonight> =
Tonight$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace Tonight$ {
/** @deprecated use `Tonight$inboundSchema` instead. */
export const inboundSchema = Tonight$inboundSchema;
/** @deprecated use `Tonight$outboundSchema` instead. */
export const outboundSchema = Tonight$outboundSchema;
}
/** @internal */
export const Skip$inboundSchema: z.ZodNativeEnum<typeof Skip> = z.nativeEnum(
Skip,
);
/** @internal */
export const Skip$outboundSchema: z.ZodNativeEnum<typeof Skip> =
Skip$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace Skip$ {
/** @deprecated use `Skip$inboundSchema` instead. */
export const inboundSchema = Skip$inboundSchema;
/** @deprecated use `Skip$outboundSchema` instead. */
export const outboundSchema = Skip$outboundSchema;
}
/** @internal */
export const ApplyUpdatesRequest$inboundSchema: z.ZodType<
ApplyUpdatesRequest,
z.ZodTypeDef,
unknown
> = z.object({
tonight: Tonight$inboundSchema.optional(),
skip: Skip$inboundSchema.optional(),
});
/** @internal */
export type ApplyUpdatesRequest$Outbound = {
tonight?: number | undefined;
skip?: number | undefined;
};
/** @internal */
export const ApplyUpdatesRequest$outboundSchema: z.ZodType<
ApplyUpdatesRequest$Outbound,
z.ZodTypeDef,
ApplyUpdatesRequest
> = z.object({
tonight: Tonight$outboundSchema.optional(),
skip: Skip$outboundSchema.optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ApplyUpdatesRequest$ {
/** @deprecated use `ApplyUpdatesRequest$inboundSchema` instead. */
export const inboundSchema = ApplyUpdatesRequest$inboundSchema;
/** @deprecated use `ApplyUpdatesRequest$outboundSchema` instead. */
export const outboundSchema = ApplyUpdatesRequest$outboundSchema;
/** @deprecated use `ApplyUpdatesRequest$Outbound` instead. */
export type Outbound = ApplyUpdatesRequest$Outbound;
}
export function applyUpdatesRequestToJSON(
applyUpdatesRequest: ApplyUpdatesRequest,
): string {
return JSON.stringify(
ApplyUpdatesRequest$outboundSchema.parse(applyUpdatesRequest),
);
}
export function applyUpdatesRequestFromJSON(
jsonString: string,
): SafeParseResult<ApplyUpdatesRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => ApplyUpdatesRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ApplyUpdatesRequest' from JSON`,
);
}
/** @internal */
export const ApplyUpdatesResponse$inboundSchema: z.ZodType<
ApplyUpdatesResponse,
z.ZodTypeDef,
unknown
> = z.object({
ContentType: z.string(),
StatusCode: z.number().int(),
RawResponse: z.instanceof(Response),
}).transform((v) => {
return remap$(v, {
"ContentType": "contentType",
"StatusCode": "statusCode",
"RawResponse": "rawResponse",
});
});
/** @internal */
export type ApplyUpdatesResponse$Outbound = {
ContentType: string;
StatusCode: number;
RawResponse: never;
};
/** @internal */
export const ApplyUpdatesResponse$outboundSchema: z.ZodType<
ApplyUpdatesResponse$Outbound,
z.ZodTypeDef,
ApplyUpdatesResponse
> = z.object({
contentType: z.string(),
statusCode: z.number().int(),
rawResponse: z.instanceof(Response).transform(() => {
throw new Error("Response cannot be serialized");
}),
}).transform((v) => {
return remap$(v, {
contentType: "ContentType",
statusCode: "StatusCode",
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 ApplyUpdatesResponse$ {
/** @deprecated use `ApplyUpdatesResponse$inboundSchema` instead. */
export const inboundSchema = ApplyUpdatesResponse$inboundSchema;
/** @deprecated use `ApplyUpdatesResponse$outboundSchema` instead. */
export const outboundSchema = ApplyUpdatesResponse$outboundSchema;
/** @deprecated use `ApplyUpdatesResponse$Outbound` instead. */
export type Outbound = ApplyUpdatesResponse$Outbound;
}
export function applyUpdatesResponseToJSON(
applyUpdatesResponse: ApplyUpdatesResponse,
): string {
return JSON.stringify(
ApplyUpdatesResponse$outboundSchema.parse(applyUpdatesResponse),
);
}
export function applyUpdatesResponseFromJSON(
jsonString: string,
): SafeParseResult<ApplyUpdatesResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => ApplyUpdatesResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ApplyUpdatesResponse' from JSON`,
);
}