/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; import { Webhook, Webhook$inboundSchema, Webhook$Outbound, Webhook$outboundSchema, } from "./webhook.js"; /** * Webhooks */ export type GetWebhookResponse = { /** * HTTP Response Status Code */ statusCode: number; /** * HTTP Response Status */ status: string; data: Webhook; }; /** @internal */ export const GetWebhookResponse$inboundSchema: z.ZodType< GetWebhookResponse, z.ZodTypeDef, unknown > = z.object({ status_code: z.number().int(), status: z.string(), data: Webhook$inboundSchema, }).transform((v) => { return remap$(v, { "status_code": "statusCode", }); }); /** @internal */ export type GetWebhookResponse$Outbound = { status_code: number; status: string; data: Webhook$Outbound; }; /** @internal */ export const GetWebhookResponse$outboundSchema: z.ZodType< GetWebhookResponse$Outbound, z.ZodTypeDef, GetWebhookResponse > = z.object({ statusCode: z.number().int(), status: z.string(), data: Webhook$outboundSchema, }).transform((v) => { return remap$(v, { statusCode: "status_code", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetWebhookResponse$ { /** @deprecated use `GetWebhookResponse$inboundSchema` instead. */ export const inboundSchema = GetWebhookResponse$inboundSchema; /** @deprecated use `GetWebhookResponse$outboundSchema` instead. */ export const outboundSchema = GetWebhookResponse$outboundSchema; /** @deprecated use `GetWebhookResponse$Outbound` instead. */ export type Outbound = GetWebhookResponse$Outbound; } export function getWebhookResponseToJSON( getWebhookResponse: GetWebhookResponse, ): string { return JSON.stringify( GetWebhookResponse$outboundSchema.parse(getWebhookResponse), ); } export function getWebhookResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetWebhookResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetWebhookResponse' from JSON`, ); }