/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PaginationCoverage, PaginationCoverage$inboundSchema, } from "./paginationcoverage.js"; import { ResourceStatus, ResourceStatus$inboundSchema, } from "./resourcestatus.js"; import { SupportedProperty, SupportedProperty$inboundSchema, } 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 > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), downstream_id: types.optional(types.string()), downstream_name: types.optional(types.string()), status: types.optional(ResourceStatus$inboundSchema), pagination_supported: types.optional(types.boolean()), pagination: types.optional(PaginationCoverage$inboundSchema), custom_fields_supported: types.optional(types.boolean()), supported_operations: types.optional(z.array(types.string())), downstream_unsupported_operations: types.optional(z.array(types.string())), supported_filters: types.optional(z.array(types.string())), supported_sort_by: types.optional(z.array(types.string())), supported_fields: types.optional(z.array(SupportedProperty$inboundSchema)), supported_list_fields: types.optional( z.array(SupportedProperty$inboundSchema), ), }).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", }); }) ); export function connectorResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConnectorResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorResource' from JSON`, ); }