karso/front/src/back-api/model/create-token-request.ts

42 lines
1.1 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodInteger} from "./integer";
export const ZodCreateTokenRequest = zod.object({
name: zod.string().optional(),
validity: ZodInteger.optional(),
});
export type CreateTokenRequest = zod.infer<typeof ZodCreateTokenRequest>;
export function isCreateTokenRequest(data: any): data is CreateTokenRequest {
try {
ZodCreateTokenRequest.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodCreateTokenRequest' error=${e}`);
return false;
}
}
export const ZodCreateTokenRequestWrite = zod.object({
name: zod.string().nullable().optional(),
validity: ZodInteger.nullable().optional(),
});
export type CreateTokenRequestWrite = zod.infer<typeof ZodCreateTokenRequestWrite>;
export function isCreateTokenRequestWrite(data: any): data is CreateTokenRequestWrite {
try {
ZodCreateTokenRequestWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodCreateTokenRequestWrite' error=${e}`);
return false;
}
}