/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BatchSupport, BatchSupport$inboundSchema } from "./batchsupport.js"; import { ConnectorDoc, ConnectorDoc$inboundSchema } from "./connectordoc.js"; import { ConnectorEvent, ConnectorEvent$inboundSchema, } from "./connectorevent.js"; import { ConnectorOverview, ConnectorOverview$inboundSchema, } from "./connectoroverview.js"; import { ConnectorSetting, ConnectorSetting$inboundSchema, } from "./connectorsetting.js"; import { ConnectorStatus, ConnectorStatus$inboundSchema, } from "./connectorstatus.js"; import { LinkedConnectorResource, LinkedConnectorResource$inboundSchema, } from "./linkedconnectorresource.js"; import { SchemaSupport, SchemaSupport$inboundSchema } from "./schemasupport.js"; import { UnifiedApiId, UnifiedApiId$inboundSchema } from "./unifiedapiid.js"; import { WebhookSupport, WebhookSupport$inboundSchema, } from "./webhooksupport.js"; /** * Type of authorization used by the connector */ export const ConnectorAuthType = { Oauth2: "oauth2", ApiKey: "apiKey", Basic: "basic", Custom: "custom", None: "none", } as const; /** * Type of authorization used by the connector */ export type ConnectorAuthType = OpenEnum; /** * OAuth grant type used by the connector. More info: https://oauth.net/2/grant-types */ export const ConnectorOauthGrantType = { AuthorizationCode: "authorization_code", ClientCredentials: "client_credentials", Password: "password", } as const; /** * OAuth grant type used by the connector. More info: https://oauth.net/2/grant-types */ export type ConnectorOauthGrantType = OpenEnum; /** * Location of the OAuth client credentials. For most connectors the OAuth client credentials are stored on integration and managed by the application owner. For others they are stored on connection and managed by the consumer in Vault. */ export const OauthCredentialsSource = { Integration: "integration", Connection: "connection", } as const; /** * Location of the OAuth client credentials. For most connectors the OAuth client credentials are stored on integration and managed by the application owner. For others they are stored on connection and managed by the consumer in Vault. */ export type OauthCredentialsSource = OpenEnum; export type OauthScopes = { /** * ID of the OAuth scope. */ id?: string | undefined; /** * Label of the OAuth scope. */ label?: string | undefined; /** * List of Unified APIs that request this OAuth Scope by default. Application owners can customize the requested scopes. */ defaultApis?: Array | undefined; }; /** * OAuth scopes required for the connector. Add these scopes to your OAuth app. */ export type ConnectorOauthScopes = { /** * ID of the OAuth scope. */ id?: string | undefined; /** * Label of the OAuth scope. */ label?: string | undefined; }; export type UnifiedApis = { /** * Name of Apideck Unified API */ id?: UnifiedApiId | undefined; /** * Name of the API. */ name?: string | undefined; /** * Indicates whether a connector only supports authentication. In this case the connector is not mapped to a Unified API, but can be used with the Proxy API */ authOnly?: boolean | undefined; oauthScopes?: Array | undefined; /** * List of resources that are supported on the connector. */ supportedResources?: Array | undefined; /** * List of resources that are not supported on the downstream. */ downstreamUnsupportedResources?: Array | undefined; /** * List of events that are supported on the connector for this Unified API. */ supportedEvents?: Array | undefined; }; export type TlsSupport = { type?: string | undefined; /** * Description of the TLS support */ description?: string | undefined; }; export type Connector = { /** * ID of the connector. */ id?: string | undefined; /** * Name of the connector. */ name?: string | undefined; /** * Status of the connector. Connectors with status live or beta are callable. */ status?: ConnectorStatus | undefined; /** * A description of the object. */ description?: string | null | undefined; /** * Link to a small square icon for the connector. */ iconUrl?: string | undefined; /** * Link to the full logo for the connector. */ logoUrl?: string | undefined; /** * Link to the connector's website. */ websiteUrl?: string | undefined; /** * Link to the connector's signup page. */ signupUrl?: string | undefined; /** * Link to the connector's partner program signup page. */ partnerSignupUrl?: string | undefined; /** * Set to `true` when the connector offers a free trial. Use `signup_url` to sign up for a free trial */ freeTrialAvailable?: boolean | undefined; /** * Service ids of connectors this connector's connections can be migrated to via the Vault connectionsMigrate operation. */ migrationTargets?: Array | undefined; /** * Type of authorization used by the connector */ authType?: ConnectorAuthType | undefined; /** * Indicates whether a connector only supports authentication. In this case the connector is not mapped to a Unified API, but can be used with the Proxy API */ authOnly?: boolean | undefined; /** * Set to `true` when connector was implemented from downstream docs only and without API access. This state indicates that integration will require Apideck support, and access to downstream API to validate mapping quality. */ blindMapped?: boolean | undefined; /** * OAuth grant type used by the connector. More info: https://oauth.net/2/grant-types */ oauthGrantType?: ConnectorOauthGrantType | undefined; /** * Location of the OAuth client credentials. For most connectors the OAuth client credentials are stored on integration and managed by the application owner. For others they are stored on connection and managed by the consumer in Vault. */ oauthCredentialsSource?: OauthCredentialsSource | undefined; /** * List of OAuth Scopes available for this connector. */ oauthScopes?: Array | undefined; /** * Set to `true` when connector allows the definition of custom scopes. */ customScopes?: boolean | undefined; /** * Indicates whether Apideck Sandbox OAuth credentials are available. */ hasSandboxCredentials?: boolean | undefined; settings?: Array | undefined; /** * Service provider identifier */ serviceId?: string | undefined; /** * List of Unified APIs that feature this connector. */ unifiedApis?: Array | undefined; /** * List of resources that are supported on the connector. */ supportedResources?: Array | undefined; /** * List of resources that have settings that can be configured. */ configurableResources?: Array | undefined; /** * List of events that are supported on the connector across all Unified APIs. */ supportedEvents?: Array | undefined; /** * How webhooks are supported for the connector. Sometimes the connector natively supports webhooks, other times Apideck virtualizes them based on polling. */ webhookSupport?: WebhookSupport | undefined; /** * How this connector satisfies a batch write, per resource. Read this before calling a batch endpoint: support, execution mode and the per-request limit all vary by resource on the same connector, and the mode determines both latency and how many requests the call counts against your plan. */ batchSupport?: BatchSupport | undefined; /** * When a connector has schema_support, a call can be made to retrieve a json schema that describes a downstream resource. */ schemaSupport?: SchemaSupport | undefined; docs?: Array | undefined; /** * Editorial overview metadata for the connector, used to render the connector's Overview documentation (implementation difficulty, partnership requirements, sandbox availability, and other at-a-glance facts). */ overview?: ConnectorOverview | undefined; tlsSupport?: TlsSupport | undefined; }; /** @internal */ export const ConnectorAuthType$inboundSchema: z.ZodType< ConnectorAuthType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ConnectorAuthType) ); /** @internal */ export const ConnectorOauthGrantType$inboundSchema: z.ZodType< ConnectorOauthGrantType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ConnectorOauthGrantType) ); /** @internal */ export const OauthCredentialsSource$inboundSchema: z.ZodType< OauthCredentialsSource, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(OauthCredentialsSource) ); /** @internal */ export const OauthScopes$inboundSchema: z.ZodType< OauthScopes, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), label: types.optional(types.string()), default_apis: types.optional(z.array(types.string())), }).transform((v) => { return remap$(v, { "default_apis": "defaultApis", }); }) ); export function oauthScopesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OauthScopes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OauthScopes' from JSON`, ); } /** @internal */ export const ConnectorOauthScopes$inboundSchema: z.ZodType< ConnectorOauthScopes, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), label: types.optional(types.string()), }) ); export function connectorOauthScopesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConnectorOauthScopes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorOauthScopes' from JSON`, ); } /** @internal */ export const UnifiedApis$inboundSchema: z.ZodType< UnifiedApis, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(UnifiedApiId$inboundSchema), name: types.optional(types.string()), auth_only: types.optional(types.boolean()), oauth_scopes: types.optional( z.array(z.lazy(() => ConnectorOauthScopes$inboundSchema)), ), supported_resources: types.optional( z.array(LinkedConnectorResource$inboundSchema), ), downstream_unsupported_resources: types.optional(z.array(types.string())), supported_events: types.optional(z.array(ConnectorEvent$inboundSchema)), }).transform((v) => { return remap$(v, { "auth_only": "authOnly", "oauth_scopes": "oauthScopes", "supported_resources": "supportedResources", "downstream_unsupported_resources": "downstreamUnsupportedResources", "supported_events": "supportedEvents", }); }) ); export function unifiedApisFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UnifiedApis$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnifiedApis' from JSON`, ); } /** @internal */ export const TlsSupport$inboundSchema: z.ZodType< TlsSupport, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ type: types.optional(types.string()), description: types.optional(types.string()), }) ); export function tlsSupportFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TlsSupport$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TlsSupport' from JSON`, ); } /** @internal */ export const Connector$inboundSchema: z.ZodType< Connector, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), status: types.optional(ConnectorStatus$inboundSchema), description: z.nullable(types.string()).optional(), icon_url: types.optional(types.string()), logo_url: types.optional(types.string()), website_url: types.optional(types.string()), signup_url: types.optional(types.string()), partner_signup_url: types.optional(types.string()), free_trial_available: types.optional(types.boolean()), migration_targets: types.optional(z.array(types.string())), auth_type: types.optional(ConnectorAuthType$inboundSchema), auth_only: types.optional(types.boolean()), blind_mapped: types.optional(types.boolean()), oauth_grant_type: types.optional(ConnectorOauthGrantType$inboundSchema), oauth_credentials_source: types.optional( OauthCredentialsSource$inboundSchema, ), oauth_scopes: types.optional( z.array(z.lazy(() => OauthScopes$inboundSchema)), ), custom_scopes: types.optional(types.boolean()), has_sandbox_credentials: types.optional(types.boolean()), settings: types.optional(z.array(ConnectorSetting$inboundSchema)), service_id: types.optional(types.string()), unified_apis: types.optional( z.array(z.lazy(() => UnifiedApis$inboundSchema)), ), supported_resources: types.optional( z.array(LinkedConnectorResource$inboundSchema), ), configurable_resources: types.optional(z.array(types.string())), supported_events: types.optional(z.array(ConnectorEvent$inboundSchema)), webhook_support: types.optional(WebhookSupport$inboundSchema), batch_support: types.optional(BatchSupport$inboundSchema), schema_support: types.optional(SchemaSupport$inboundSchema), docs: types.optional(z.array(ConnectorDoc$inboundSchema)), overview: types.optional(ConnectorOverview$inboundSchema), tls_support: types.optional(z.lazy(() => TlsSupport$inboundSchema)), }).transform((v) => { return remap$(v, { "icon_url": "iconUrl", "logo_url": "logoUrl", "website_url": "websiteUrl", "signup_url": "signupUrl", "partner_signup_url": "partnerSignupUrl", "free_trial_available": "freeTrialAvailable", "migration_targets": "migrationTargets", "auth_type": "authType", "auth_only": "authOnly", "blind_mapped": "blindMapped", "oauth_grant_type": "oauthGrantType", "oauth_credentials_source": "oauthCredentialsSource", "oauth_scopes": "oauthScopes", "custom_scopes": "customScopes", "has_sandbox_credentials": "hasSandboxCredentials", "service_id": "serviceId", "unified_apis": "unifiedApis", "supported_resources": "supportedResources", "configurable_resources": "configurableResources", "supported_events": "supportedEvents", "webhook_support": "webhookSupport", "batch_support": "batchSupport", "schema_support": "schemaSupport", "tls_support": "tlsSupport", }); }) ); export function connectorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Connector$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Connector' from JSON`, ); }