/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Webhook, Webhook$inboundSchema, Webhook$Outbound, Webhook$outboundSchema, } from "./webhook.js"; /** * Response from pinging a webhook. */ export type PingResponse = { /** * The webhook that was pinged. */ webhook: Webhook; /** * The request body sent to the target URL. It will contain an event type of `event.test` and an empty (null) data payload. */ requestBodySent: { [k: string]: any }; /** * The response status code after sending a ping event to the URL. */ responseStatusCode: number; }; /** @internal */ export const PingResponse$inboundSchema: z.ZodType< PingResponse, z.ZodTypeDef, unknown > = z.object({ webhook: Webhook$inboundSchema, requestBodySent: z.record(z.any()), responseStatusCode: z.number().int(), }); /** @internal */ export type PingResponse$Outbound = { webhook: Webhook$Outbound; requestBodySent: { [k: string]: any }; responseStatusCode: number; }; /** @internal */ export const PingResponse$outboundSchema: z.ZodType< PingResponse$Outbound, z.ZodTypeDef, PingResponse > = z.object({ webhook: Webhook$outboundSchema, requestBodySent: z.record(z.any()), responseStatusCode: z.number().int(), }); export function pingResponseToJSON(pingResponse: PingResponse): string { return JSON.stringify(PingResponse$outboundSchema.parse(pingResponse)); } export function pingResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PingResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PingResponse' from JSON`, ); }