Files
plexjs/src/models/operations/uploadplaylist.ts

145 lines
4.2 KiB
TypeScript

/*
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/
import * as z from "zod";
/**
* Force overwriting of duplicate playlists.
*
* @remarks
* By default, a playlist file uploaded with the same path will overwrite the existing playlist.
* The `force` argument is used to disable overwriting.
* If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
*
*/
export enum Force {
Zero = 0,
One = 1,
}
export type UploadPlaylistRequest = {
/**
* absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server.
*
* @remarks
* If the `path` argument is a directory, that path will be scanned for playlist files to be processed.
* Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it.
* The GUID of each playlist is based on the filename.
* If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it.
* The GUID of each playlist is based on the filename.
*
*/
path: string;
/**
* Force overwriting of duplicate playlists.
*
* @remarks
* By default, a playlist file uploaded with the same path will overwrite the existing playlist.
* The `force` argument is used to disable overwriting.
* If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
*
*/
force: Force;
};
export type UploadPlaylistResponse = {
/**
* 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 Force$: z.ZodNativeEnum<typeof Force> = z.nativeEnum(Force);
/** @internal */
export namespace UploadPlaylistRequest$ {
export type Inbound = {
path: string;
force: Force;
};
export const inboundSchema: z.ZodType<UploadPlaylistRequest, z.ZodTypeDef, Inbound> = z
.object({
path: z.string(),
force: Force$,
})
.transform((v) => {
return {
path: v.path,
force: v.force,
};
});
export type Outbound = {
path: string;
force: Force;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, UploadPlaylistRequest> = z
.object({
path: z.string(),
force: Force$,
})
.transform((v) => {
return {
path: v.path,
force: v.force,
};
});
}
/** @internal */
export namespace UploadPlaylistResponse$ {
export type Inbound = {
ContentType: string;
StatusCode: number;
RawResponse: Response;
};
export const inboundSchema: z.ZodType<UploadPlaylistResponse, z.ZodTypeDef, Inbound> = z
.object({
ContentType: z.string(),
StatusCode: z.number().int(),
RawResponse: z.instanceof(Response),
})
.transform((v) => {
return {
contentType: v.ContentType,
statusCode: v.StatusCode,
rawResponse: v.RawResponse,
};
});
export type Outbound = {
ContentType: string;
StatusCode: number;
RawResponse: never;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, UploadPlaylistResponse> = z
.object({
contentType: z.string(),
statusCode: z.number().int(),
rawResponse: z.instanceof(Response).transform(() => {
throw new Error("Response cannot be serialized");
}),
})
.transform((v) => {
return {
ContentType: v.contentType,
StatusCode: v.statusCode,
RawResponse: v.rawResponse,
};
});
}