/** * Interface of the server (auto-generated code) */ import { z as zod } from "zod"; export const ZodUUID = zod.string().uuid(); export type UUID = zod.infer; export function isUUID(data: any): data is UUID { try { ZodUUID.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodLong = zod.number(); export type Long = zod.infer; export function isLong(data: any): data is Long { try { ZodLong.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodInteger = zod.number().safe(); export type Integer = zod.infer; export function isInteger(data: any): data is Integer { try { ZodInteger.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodFloat = zod.number(); export type Float = zod.infer; export function isFloat(data: any): data is Float { try { ZodFloat.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodInstant = zod.string(); export type Instant = zod.infer; export function isInstant(data: any): data is Instant { try { ZodInstant.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodDate = zod.date(); export type Date = zod.infer; export function isDate(data: any): data is Date { try { ZodDate.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodTimestamp = zod.date(); export type Timestamp = zod.infer; export function isTimestamp(data: any): data is Timestamp { try { ZodTimestamp.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodLocalDate = zod.date(); export type LocalDate = zod.infer; export function isLocalDate(data: any): data is LocalDate { try { ZodLocalDate.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodLocalTime = zod.date(); export type LocalTime = zod.infer; export function isLocalTime(data: any): data is LocalTime { try { ZodLocalTime.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodRestErrorResponse = zod.object({ uuid: ZodUUID.optional(), name: zod.string().max(255).optional(), message: zod.string().max(255).optional(), time: zod.string().max(255).optional(), status: ZodInteger, statusMessage: zod.string().max(255).optional() }); export type RestErrorResponse = zod.infer; export function isRestErrorResponse(data: any): data is RestErrorResponse { try { ZodRestErrorResponse.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodHealthResult = zod.object({ }); export type HealthResult = zod.infer; export function isHealthResult(data: any): data is HealthResult { try { ZodHealthResult.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodGenericTiming = zod.object({ // Create time of the object createdAt: ZodDate.readonly().optional(), // When update the object updatedAt: ZodDate.readonly().optional() }); export type GenericTiming = zod.infer; export function isGenericTiming(data: any): data is GenericTiming { try { ZodGenericTiming.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodGenericData = ZodGenericTiming.extend({ // Unique Id of the object id: ZodLong.readonly().optional() }); export type GenericData = zod.infer; export function isGenericData(data: any): data is GenericData { try { ZodGenericData.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodGenericDataSoftDelete = ZodGenericData.extend({ // Deleted state deleted: zod.boolean().readonly().optional() }); export type GenericDataSoftDelete = zod.infer; export function isGenericDataSoftDelete(data: any): data is GenericDataSoftDelete { try { ZodGenericDataSoftDelete.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodSeason = ZodGenericDataSoftDelete.extend({ // Name of the media (this represent the title) name: zod.string().optional(), // Description of the media description: zod.string().optional(), // series parent ID parentId: ZodLong.optional(), // List of Id of the specific covers covers: zod.array(ZodUUID).optional() }); export type Season = zod.infer; export function isSeason(data: any): data is Season { try { ZodSeason.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodSeries = ZodGenericDataSoftDelete.extend({ // Name of the media (this represent the title) name: zod.string().optional(), // Description of the media description: zod.string().optional(), // series parent ID parentId: ZodLong.optional(), // List of Id of the specific covers covers: zod.array(ZodUUID).optional() }); export type Series = zod.infer; export function isSeries(data: any): data is Series { try { ZodSeries.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodType = ZodGenericDataSoftDelete.extend({ // Name of the media (this represent the title) name: zod.string().optional(), // Description of the media description: zod.string().optional(), // List of Id of the specific covers covers: zod.array(ZodUUID).optional() }); export type Type = zod.infer; export function isType(data: any): data is Type { try { ZodType.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodUserMediaAdvancement = ZodGenericDataSoftDelete.extend({ // Foreign Key Id of the user userId: ZodLong.optional(), // Id of the media mediaId: ZodLong.optional(), // Percent of advancement in the media percent: ZodFloat.optional(), // Number of second of advancement in the media time: ZodInteger.optional(), // Number of time this media has been read count: ZodInteger.optional() }); export type UserMediaAdvancement = zod.infer; export function isUserMediaAdvancement(data: any): data is UserMediaAdvancement { try { ZodUserMediaAdvancement.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodMediaInformationsDelta = zod.object({ }); export type MediaInformationsDelta = zod.infer; export function isMediaInformationsDelta(data: any): data is MediaInformationsDelta { try { ZodMediaInformationsDelta.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodUser = ZodGenericDataSoftDelete.extend({ login: zod.string().max(128).optional(), lastConnection: ZodTimestamp.optional(), admin: zod.boolean(), blocked: zod.boolean(), removed: zod.boolean(), covers: zod.array(ZodLong).optional() }); export type User = zod.infer; export function isUser(data: any): data is User { try { ZodUser.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodUserKarideo = ZodUser.extend({ }); export type UserKarideo = zod.infer; export function isUserKarideo(data: any): data is UserKarideo { try { ZodUserKarideo.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodUserOut = zod.object({ id: ZodLong, login: zod.string().max(255).optional() }); export type UserOut = zod.infer; export function isUserOut(data: any): data is UserOut { try { ZodUserOut.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodMedia = ZodGenericDataSoftDelete.extend({ name: zod.string().optional(), description: zod.string().optional(), dataId: ZodUUID.optional(), typeId: ZodLong.optional(), seriesId: ZodLong.optional(), seasonId: ZodLong.optional(), episode: ZodInteger.optional(), date: ZodInteger.optional(), time: ZodInteger.optional(), ageLimit: ZodInteger.optional(), covers: zod.array(ZodUUID).optional() }); export type Media = zod.infer; export function isMedia(data: any): data is Media { try { ZodMedia.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodUUIDGenericData = ZodGenericTiming.extend({ // Unique UUID of the object id: ZodUUID.readonly().optional() }); export type UUIDGenericData = zod.infer; export function isUUIDGenericData(data: any): data is UUIDGenericData { try { ZodUUIDGenericData.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodUUIDGenericDataSoftDelete = ZodUUIDGenericData.extend({ // Deleted state deleted: zod.boolean().readonly().optional() }); export type UUIDGenericDataSoftDelete = zod.infer; export function isUUIDGenericDataSoftDelete(data: any): data is UUIDGenericDataSoftDelete { try { ZodUUIDGenericDataSoftDelete.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } } export const ZodData = ZodUUIDGenericDataSoftDelete.extend({ // Sha512 of the data sha512: zod.string().max(128).optional(), // Mime -type of the media mimeType: zod.string().max(128).optional(), // Size in Byte of the data size: ZodLong.optional() }); export type Data = zod.infer; export function isData(data: any): data is Data { try { ZodData.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data ${e}`); return false; } }