/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateWebhookRequest = { id: string; webhook: components.WebhookInput; }; export type UpdateWebhookResponse = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; /** * Success */ webhook?: components.Webhook | undefined; /** * Error */ error?: components.ErrorT | undefined; }; /** @internal */ export const UpdateWebhookRequest$inboundSchema: z.ZodType< UpdateWebhookRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), webhook: components.WebhookInput$inboundSchema, }); /** @internal */ export type UpdateWebhookRequest$Outbound = { id: string; webhook: components.WebhookInput$Outbound; }; /** @internal */ export const UpdateWebhookRequest$outboundSchema: z.ZodType< UpdateWebhookRequest$Outbound, z.ZodTypeDef, UpdateWebhookRequest > = z.object({ id: z.string(), webhook: components.WebhookInput$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UpdateWebhookRequest$ { /** @deprecated use `UpdateWebhookRequest$inboundSchema` instead. */ export const inboundSchema = UpdateWebhookRequest$inboundSchema; /** @deprecated use `UpdateWebhookRequest$outboundSchema` instead. */ export const outboundSchema = UpdateWebhookRequest$outboundSchema; /** @deprecated use `UpdateWebhookRequest$Outbound` instead. */ export type Outbound = UpdateWebhookRequest$Outbound; } export function updateWebhookRequestToJSON( updateWebhookRequest: UpdateWebhookRequest, ): string { return JSON.stringify( UpdateWebhookRequest$outboundSchema.parse(updateWebhookRequest), ); } export function updateWebhookRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateWebhookRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateWebhookRequest' from JSON`, ); } /** @internal */ export const UpdateWebhookResponse$inboundSchema: z.ZodType< UpdateWebhookResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), webhook: components.Webhook$inboundSchema.optional(), error: components.ErrorT$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", }); }); /** @internal */ export type UpdateWebhookResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; webhook?: components.Webhook$Outbound | undefined; error?: components.ErrorT$Outbound | undefined; }; /** @internal */ export const UpdateWebhookResponse$outboundSchema: z.ZodType< UpdateWebhookResponse$Outbound, z.ZodTypeDef, UpdateWebhookResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), webhook: components.Webhook$outboundSchema.optional(), error: components.ErrorT$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UpdateWebhookResponse$ { /** @deprecated use `UpdateWebhookResponse$inboundSchema` instead. */ export const inboundSchema = UpdateWebhookResponse$inboundSchema; /** @deprecated use `UpdateWebhookResponse$outboundSchema` instead. */ export const outboundSchema = UpdateWebhookResponse$outboundSchema; /** @deprecated use `UpdateWebhookResponse$Outbound` instead. */ export type Outbound = UpdateWebhookResponse$Outbound; } export function updateWebhookResponseToJSON( updateWebhookResponse: UpdateWebhookResponse, ): string { return JSON.stringify( UpdateWebhookResponse$outboundSchema.parse(updateWebhookResponse), ); } export function updateWebhookResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateWebhookResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateWebhookResponse' from JSON`, ); }