fathom-typescript
Version:
Fathom's official TypeScript SDK.
43 lines (38 loc) • 1.03 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
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";
export type FathomUser = {
name: string;
email: string;
emailDomain: string;
team: string | null;
};
/** @internal */
export const FathomUser$inboundSchema: z.ZodType<
FathomUser,
z.ZodTypeDef,
unknown
> = z.object({
name: z.string(),
email: z.string(),
email_domain: z.string(),
team: z.nullable(z.string()),
}).transform((v) => {
return remap$(v, {
"email_domain": "emailDomain",
});
});
export function fathomUserFromJSON(
jsonString: string,
): SafeParseResult<FathomUser, SDKValidationError> {
return safeParse(
jsonString,
(x) => FathomUser$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FathomUser' from JSON`,
);
}