/* * 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 CreateWebhookEndpointPayload = { name: string; url: string; partitionPattern?: string | null | undefined; }; /** @internal */ export const CreateWebhookEndpointPayload$inboundSchema: z.ZodType< CreateWebhookEndpointPayload, z.ZodTypeDef, unknown > = z.object({ name: z.string(), url: z.string(), partition_pattern: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "partition_pattern": "partitionPattern", }); }); /** @internal */ export type CreateWebhookEndpointPayload$Outbound = { name: string; url: string; partition_pattern?: string | null | undefined; }; /** @internal */ export const CreateWebhookEndpointPayload$outboundSchema: z.ZodType< CreateWebhookEndpointPayload$Outbound, z.ZodTypeDef, CreateWebhookEndpointPayload > = z.object({ name: z.string(), url: z.string(), partitionPattern: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { partitionPattern: "partition_pattern", }); }); export function createWebhookEndpointPayloadToJSON( createWebhookEndpointPayload: CreateWebhookEndpointPayload, ): string { return JSON.stringify( CreateWebhookEndpointPayload$outboundSchema.parse( createWebhookEndpointPayload, ), ); } export function createWebhookEndpointPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateWebhookEndpointPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateWebhookEndpointPayload' from JSON`, ); }