/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Filter destinations by type(s). Use bracket notation for multiple values (e.g., `type[0]=webhook&type[1]=aws_sqs`). */ export type ListTenantDestinationsType = | components.DestinationType | Array; /** * Filter destinations by supported topic(s). Use bracket notation for multiple values (e.g., `topics[0]=user.created&topics[1]=user.deleted`). */ export type Topics = string | Array; export type ListTenantDestinationsRequest = { /** * The ID of the tenant. Required when using AdminApiKey authentication. */ tenantId: string; /** * Filter destinations by type(s). Use bracket notation for multiple values (e.g., `type[0]=webhook&type[1]=aws_sqs`). */ type?: | components.DestinationType | Array | undefined; /** * Filter destinations by supported topic(s). Use bracket notation for multiple values (e.g., `topics[0]=user.created&topics[1]=user.deleted`). */ topics?: string | Array | undefined; }; /** @internal */ export const ListTenantDestinationsType$inboundSchema: z.ZodType< ListTenantDestinationsType, z.ZodTypeDef, unknown > = z.union([ components.DestinationType$inboundSchema, z.array(components.DestinationType$inboundSchema), ]); /** @internal */ export type ListTenantDestinationsType$Outbound = string | Array; /** @internal */ export const ListTenantDestinationsType$outboundSchema: z.ZodType< ListTenantDestinationsType$Outbound, z.ZodTypeDef, ListTenantDestinationsType > = z.union([ components.DestinationType$outboundSchema, z.array(components.DestinationType$outboundSchema), ]); export function listTenantDestinationsTypeToJSON( listTenantDestinationsType: ListTenantDestinationsType, ): string { return JSON.stringify( ListTenantDestinationsType$outboundSchema.parse(listTenantDestinationsType), ); } export function listTenantDestinationsTypeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTenantDestinationsType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTenantDestinationsType' from JSON`, ); } /** @internal */ export const Topics$inboundSchema: z.ZodType = z .union([z.string(), z.array(z.string())]); /** @internal */ export type Topics$Outbound = string | Array; /** @internal */ export const Topics$outboundSchema: z.ZodType< Topics$Outbound, z.ZodTypeDef, Topics > = z.union([z.string(), z.array(z.string())]); export function topicsToJSON(topics: Topics): string { return JSON.stringify(Topics$outboundSchema.parse(topics)); } export function topicsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Topics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Topics' from JSON`, ); } /** @internal */ export const ListTenantDestinationsRequest$inboundSchema: z.ZodType< ListTenantDestinationsRequest, z.ZodTypeDef, unknown > = z.object({ tenant_id: z.string(), type: z.union([ components.DestinationType$inboundSchema, z.array(components.DestinationType$inboundSchema), ]).optional(), topics: z.union([z.string(), z.array(z.string())]).optional(), }).transform((v) => { return remap$(v, { "tenant_id": "tenantId", }); }); /** @internal */ export type ListTenantDestinationsRequest$Outbound = { tenant_id: string; type?: string | Array | undefined; topics?: string | Array | undefined; }; /** @internal */ export const ListTenantDestinationsRequest$outboundSchema: z.ZodType< ListTenantDestinationsRequest$Outbound, z.ZodTypeDef, ListTenantDestinationsRequest > = z.object({ tenantId: z.string(), type: z.union([ components.DestinationType$outboundSchema, z.array(components.DestinationType$outboundSchema), ]).optional(), topics: z.union([z.string(), z.array(z.string())]).optional(), }).transform((v) => { return remap$(v, { tenantId: "tenant_id", }); }); export function listTenantDestinationsRequestToJSON( listTenantDestinationsRequest: ListTenantDestinationsRequest, ): string { return JSON.stringify( ListTenantDestinationsRequest$outboundSchema.parse( listTenantDestinationsRequest, ), ); } export function listTenantDestinationsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTenantDestinationsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTenantDestinationsRequest' from JSON`, ); }