/* * 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 ListServiceAccountsRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type ServiceAccounts = { id: string; orgId: string; name: string; createdAt: string; }; /** * OK */ export type ListServiceAccountsResponseBody = { serviceAccounts: Array; }; /** @internal */ export const ListServiceAccountsRequest$inboundSchema: z.ZodType< ListServiceAccountsRequest, z.ZodTypeDef, unknown > = z.object({ orgId: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListServiceAccountsRequest$Outbound = { orgId: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListServiceAccountsRequest$outboundSchema: z.ZodType< ListServiceAccountsRequest$Outbound, z.ZodTypeDef, ListServiceAccountsRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listServiceAccountsRequestToJSON( listServiceAccountsRequest: ListServiceAccountsRequest, ): string { return JSON.stringify( ListServiceAccountsRequest$outboundSchema.parse(listServiceAccountsRequest), ); } export function listServiceAccountsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListServiceAccountsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListServiceAccountsRequest' from JSON`, ); } /** @internal */ export const ServiceAccounts$inboundSchema: z.ZodType< ServiceAccounts, z.ZodTypeDef, unknown > = z.object({ id: z.string(), orgId: z.string(), name: z.string(), createdAt: z.string(), }); /** @internal */ export type ServiceAccounts$Outbound = { id: string; orgId: string; name: string; createdAt: string; }; /** @internal */ export const ServiceAccounts$outboundSchema: z.ZodType< ServiceAccounts$Outbound, z.ZodTypeDef, ServiceAccounts > = z.object({ id: z.string(), orgId: z.string(), name: z.string(), createdAt: z.string(), }); export function serviceAccountsToJSON( serviceAccounts: ServiceAccounts, ): string { return JSON.stringify(ServiceAccounts$outboundSchema.parse(serviceAccounts)); } export function serviceAccountsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ServiceAccounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServiceAccounts' from JSON`, ); } /** @internal */ export const ListServiceAccountsResponseBody$inboundSchema: z.ZodType< ListServiceAccountsResponseBody, z.ZodTypeDef, unknown > = z.object({ serviceAccounts: z.array(z.lazy(() => ServiceAccounts$inboundSchema)), }); /** @internal */ export type ListServiceAccountsResponseBody$Outbound = { serviceAccounts: Array; }; /** @internal */ export const ListServiceAccountsResponseBody$outboundSchema: z.ZodType< ListServiceAccountsResponseBody$Outbound, z.ZodTypeDef, ListServiceAccountsResponseBody > = z.object({ serviceAccounts: z.array(z.lazy(() => ServiceAccounts$outboundSchema)), }); export function listServiceAccountsResponseBodyToJSON( listServiceAccountsResponseBody: ListServiceAccountsResponseBody, ): string { return JSON.stringify( ListServiceAccountsResponseBody$outboundSchema.parse( listServiceAccountsResponseBody, ), ); } export function listServiceAccountsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListServiceAccountsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListServiceAccountsResponseBody' from JSON`, ); }