/* * 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 ConnectorResource = { /** * ID of the resource, typically a lowercased version of name. */ id?: string | undefined; /** * Name of the resource (plural) */ name?: string | undefined; /** * 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; /** * Status of the resource. Resources with status live or beta are callable. */ status?: ResourceStatus | undefined; /** * Indicates if pagination (cursor and limit parameters) is supported on the list endpoint of the resource. */ paginationSupported?: boolean | undefined; pagination?: PaginationCoverage | undefined; /** * Indicates if custom fields are supported on this resource. */ customFieldsSupported?: boolean | undefined; /** * List of supported operations on the resource. */ supportedOperations?: Array | undefined; /** * List of operations that are not supported on the downstream. */ downstreamUnsupportedOperations?: 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; }; /** @internal */ export const ConnectorResource$inboundSchema: z.ZodType< ConnectorResource, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), name: z.string().optional(), downstream_id: z.string().optional(), downstream_name: z.string().optional(), status: ResourceStatus$inboundSchema.optional(), pagination_supported: z.boolean().optional(), pagination: PaginationCoverage$inboundSchema.optional(), custom_fields_supported: z.boolean().optional(), supported_operations: z.array(z.string()).optional(), downstream_unsupported_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", "custom_fields_supported": "customFieldsSupported", "supported_operations": "supportedOperations", "downstream_unsupported_operations": "downstreamUnsupportedOperations", "supported_filters": "supportedFilters", "supported_sort_by": "supportedSortBy", "supported_fields": "supportedFields", "supported_list_fields": "supportedListFields", }); }); /** @internal */ export type ConnectorResource$Outbound = { id?: string | undefined; name?: string | undefined; downstream_id?: string | undefined; downstream_name?: string | undefined; status?: string | undefined; pagination_supported?: boolean | undefined; pagination?: PaginationCoverage$Outbound | undefined; custom_fields_supported?: boolean | undefined; supported_operations?: Array | undefined; downstream_unsupported_operations?: Array | undefined; supported_filters?: Array | undefined; supported_sort_by?: Array | undefined; supported_fields?: Array | undefined; supported_list_fields?: Array | undefined; }; /** @internal */ export const ConnectorResource$outboundSchema: z.ZodType< ConnectorResource$Outbound, z.ZodTypeDef, ConnectorResource > = z.object({ id: z.string().optional(), name: z.string().optional(), downstreamId: z.string().optional(), downstreamName: z.string().optional(), status: ResourceStatus$outboundSchema.optional(), paginationSupported: z.boolean().optional(), pagination: PaginationCoverage$outboundSchema.optional(), customFieldsSupported: z.boolean().optional(), supportedOperations: z.array(z.string()).optional(), downstreamUnsupportedOperations: 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", customFieldsSupported: "custom_fields_supported", supportedOperations: "supported_operations", downstreamUnsupportedOperations: "downstream_unsupported_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 ConnectorResource$ { /** @deprecated use `ConnectorResource$inboundSchema` instead. */ export const inboundSchema = ConnectorResource$inboundSchema; /** @deprecated use `ConnectorResource$outboundSchema` instead. */ export const outboundSchema = ConnectorResource$outboundSchema; /** @deprecated use `ConnectorResource$Outbound` instead. */ export type Outbound = ConnectorResource$Outbound; } export function connectorResourceToJSON( connectorResource: ConnectorResource, ): string { return JSON.stringify( ConnectorResource$outboundSchema.parse(connectorResource), ); } export function connectorResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConnectorResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorResource' from JSON`, ); }