/* * 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 { PaginationCoverage, PaginationCoverage$inboundSchema, PaginationCoverage$Outbound, PaginationCoverage$outboundSchema, } from "./paginationcoverage.js"; import { ResourceStatus, ResourceStatus$inboundSchema, ResourceStatus$outboundSchema, } from "./resourcestatus.js"; import { SupportedProperty, SupportedProperty$inboundSchema, SupportedProperty$Outbound, SupportedProperty$outboundSchema, } from "./supportedproperty.js"; export type Coverage = { /** * ID of the resource in the Connector's API (downstream) */ downstreamId?: string | undefined; /** * Name of the resource in the Connector's API (downstream) */ downstreamName?: string | undefined; /** * Indicates if pagination (cursor and limit parameters) is supported on the list endpoint of the resource. */ paginationSupported?: boolean | undefined; pagination?: PaginationCoverage | undefined; /** * List of supported operations on the resource. */ supportedOperations?: Array | undefined; /** * Supported filters on the list endpoint of the resource. */ supportedFilters?: Array | undefined; /** * Supported sorting properties on the list endpoint of the resource. */ supportedSortBy?: Array | undefined; /** * Supported fields on the detail endpoint. */ supportedFields?: Array | undefined; /** * Supported fields on the list endpoint. */ supportedListFields?: Array | undefined; }; export type ApiResourceCoverage = { /** * ID of the resource, typically a lowercased version of name. */ id?: string | undefined; /** * Name of the resource (plural) */ name?: string | undefined; /** * Status of the resource. Resources with status live or beta are callable. */ status?: ResourceStatus | undefined; coverage?: Array | undefined; }; /** @internal */ export const Coverage$inboundSchema: z.ZodType< Coverage, z.ZodTypeDef, unknown > = z.object({ downstream_id: z.string().optional(), downstream_name: z.string().optional(), pagination_supported: z.boolean().optional(), pagination: PaginationCoverage$inboundSchema.optional(), supported_operations: z.array(z.string()).optional(), supported_filters: z.array(z.string()).optional(), supported_sort_by: z.array(z.string()).optional(), supported_fields: z.array(SupportedProperty$inboundSchema).optional(), supported_list_fields: z.array(SupportedProperty$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "downstream_name": "downstreamName", "pagination_supported": "paginationSupported", "supported_operations": "supportedOperations", "supported_filters": "supportedFilters", "supported_sort_by": "supportedSortBy", "supported_fields": "supportedFields", "supported_list_fields": "supportedListFields", }); }); /** @internal */ export type Coverage$Outbound = { downstream_id?: string | undefined; downstream_name?: string | undefined; pagination_supported?: boolean | undefined; pagination?: PaginationCoverage$Outbound | undefined; supported_operations?: Array | undefined; supported_filters?: Array | undefined; supported_sort_by?: Array | undefined; supported_fields?: Array | undefined; supported_list_fields?: Array | undefined; }; /** @internal */ export const Coverage$outboundSchema: z.ZodType< Coverage$Outbound, z.ZodTypeDef, Coverage > = z.object({ downstreamId: z.string().optional(), downstreamName: z.string().optional(), paginationSupported: z.boolean().optional(), pagination: PaginationCoverage$outboundSchema.optional(), supportedOperations: z.array(z.string()).optional(), supportedFilters: z.array(z.string()).optional(), supportedSortBy: z.array(z.string()).optional(), supportedFields: z.array(SupportedProperty$outboundSchema).optional(), supportedListFields: z.array(SupportedProperty$outboundSchema).optional(), }).transform((v) => { return remap$(v, { downstreamId: "downstream_id", downstreamName: "downstream_name", paginationSupported: "pagination_supported", supportedOperations: "supported_operations", supportedFilters: "supported_filters", supportedSortBy: "supported_sort_by", supportedFields: "supported_fields", supportedListFields: "supported_list_fields", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Coverage$ { /** @deprecated use `Coverage$inboundSchema` instead. */ export const inboundSchema = Coverage$inboundSchema; /** @deprecated use `Coverage$outboundSchema` instead. */ export const outboundSchema = Coverage$outboundSchema; /** @deprecated use `Coverage$Outbound` instead. */ export type Outbound = Coverage$Outbound; } export function coverageToJSON(coverage: Coverage): string { return JSON.stringify(Coverage$outboundSchema.parse(coverage)); } export function coverageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Coverage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Coverage' from JSON`, ); } /** @internal */ export const ApiResourceCoverage$inboundSchema: z.ZodType< ApiResourceCoverage, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string().optional(), status: ResourceStatus$inboundSchema.optional(), coverage: z.array(z.lazy(() => Coverage$inboundSchema)).optional(), }); /** @internal */ export type ApiResourceCoverage$Outbound = { id?: string | undefined; name?: string | undefined; status?: string | undefined; coverage?: Array | undefined; }; /** @internal */ export const ApiResourceCoverage$outboundSchema: z.ZodType< ApiResourceCoverage$Outbound, z.ZodTypeDef, ApiResourceCoverage > = z.object({ id: z.string().optional(), name: z.string().optional(), status: ResourceStatus$outboundSchema.optional(), coverage: z.array(z.lazy(() => Coverage$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ApiResourceCoverage$ { /** @deprecated use `ApiResourceCoverage$inboundSchema` instead. */ export const inboundSchema = ApiResourceCoverage$inboundSchema; /** @deprecated use `ApiResourceCoverage$outboundSchema` instead. */ export const outboundSchema = ApiResourceCoverage$outboundSchema; /** @deprecated use `ApiResourceCoverage$Outbound` instead. */ export type Outbound = ApiResourceCoverage$Outbound; } export function apiResourceCoverageToJSON( apiResourceCoverage: ApiResourceCoverage, ): string { return JSON.stringify( ApiResourceCoverage$outboundSchema.parse(apiResourceCoverage), ); } export function apiResourceCoverageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApiResourceCoverage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApiResourceCoverage' from JSON`, ); }