UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

643 lines (599 loc) 23.7 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smartUnion.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export const View = { Account: "account", Project: "project", } as const; export type View = ClosedEnum<typeof View>; export const InstallationType = { Marketplace: "marketplace", External: "external", Provisioning: "provisioning", } as const; export type InstallationType = ClosedEnum<typeof InstallationType>; export type GetConfigurationsRequest = { view: View; installationType?: InstallationType | undefined; /** * ID of the integration */ integrationIdOrSlug?: string | undefined; /** * The Team identifier to perform the request on behalf of. */ teamId?: string | undefined; /** * The Team slug to perform the request on behalf of. */ slug?: string | undefined; }; export const TagIds = { TagAgents: "tag_agents", TagAi: "tag_ai", TagAnalytics: "tag_analytics", TagAuthentication: "tag_authentication", TagCms: "tag_cms", TagCodeRepository: "tag_code_repository", TagCodeReview: "tag_code_review", TagCodeSecurity: "tag_code_security", TagCodeTesting: "tag_code_testing", TagCommerce: "tag_commerce", TagDatabases: "tag_databases", TagDevTools: "tag_dev_tools", TagExperimentation: "tag_experimentation", TagFlags: "tag_flags", TagLogging: "tag_logging", TagMessaging: "tag_messaging", TagMonitoring: "tag_monitoring", TagObservability: "tag_observability", TagPayments: "tag_payments", TagPerformance: "tag_performance", TagProductivity: "tag_productivity", TagSearching: "tag_searching", TagSecurity: "tag_security", TagSupportAgent: "tag_support_agent", TagTesting: "tag_testing", TagVideo: "tag_video", TagWebAutomation: "tag_web_automation", TagWorkflow: "tag_workflow", } as const; export type TagIds = ClosedEnum<typeof TagIds>; export type ResponseBodyIntegration = { name: string; icon: string; isLegacy: boolean; flags?: Array<string> | undefined; assignedBetaLabelAt?: number | undefined; tagIds?: Array<TagIds> | undefined; }; /** * The configuration status. Optional. If not defined, assume 'ready'. */ export const GetConfigurationsResponseBodyIntegrationsStatus = { Error: "error", Onboarding: "onboarding", Pending: "pending", Ready: "ready", Resumed: "resumed", Suspended: "suspended", Uninstalled: "uninstalled", } as const; /** * The configuration status. Optional. If not defined, assume 'ready'. */ export type GetConfigurationsResponseBodyIntegrationsStatus = ClosedEnum< typeof GetConfigurationsResponseBodyIntegrationsStatus >; /** * Source defines where the configuration was installed from. It is used to analyze user engagement for integration installations in product metrics. */ export const GetConfigurationsResponseBodyIntegrationsSource = { Backoffice: "backoffice", Cli: "cli", DeployButton: "deploy-button", External: "external", ImportRecommendedIntegrations: "import-recommended-integrations", Marketplace: "marketplace", Oauth: "oauth", Organization: "organization", ResourceClaims: "resource-claims", V0: "v0", } as const; /** * Source defines where the configuration was installed from. It is used to analyze user engagement for integration installations in product metrics. */ export type GetConfigurationsResponseBodyIntegrationsSource = ClosedEnum< typeof GetConfigurationsResponseBodyIntegrationsSource >; export const GetConfigurationsResponseBodyIntegrationsType = { IntegrationConfiguration: "integration-configuration", } as const; export type GetConfigurationsResponseBodyIntegrationsType = ClosedEnum< typeof GetConfigurationsResponseBodyIntegrationsType >; export const GetConfigurationsResponseBodyIntegrationsDisabledReason = { AccountPlanDowngrade: "account-plan-downgrade", DisabledByAdmin: "disabled-by-admin", DisabledByOwner: "disabled-by-owner", FeatureNotAvailable: "feature-not-available", OriginalOwnerLeftTheTeam: "original-owner-left-the-team", OriginalOwnerRoleDowngraded: "original-owner-role-downgraded", } as const; export type GetConfigurationsResponseBodyIntegrationsDisabledReason = ClosedEnum<typeof GetConfigurationsResponseBodyIntegrationsDisabledReason>; /** * Defines the installation type. - 'external' integrations are installed via the existing integrations flow - 'marketplace' integrations are natively installed: - when accepting the TOS of a partner during the store creation process - if undefined, assume 'external' */ export const GetConfigurationsResponseBodyInstallationType = { External: "external", Marketplace: "marketplace", } as const; /** * Defines the installation type. - 'external' integrations are installed via the existing integrations flow - 'marketplace' integrations are natively installed: - when accepting the TOS of a partner during the store creation process - if undefined, assume 'external' */ export type GetConfigurationsResponseBodyInstallationType = ClosedEnum< typeof GetConfigurationsResponseBodyInstallationType >; export type GetConfigurationsResponseBody2 = { integration: ResponseBodyIntegration; /** * A timestamp that tells you when the configuration was installed successfully */ completedAt?: number | undefined; /** * A timestamp that tells you when the configuration was created */ createdAt: number; /** * The unique identifier of the configuration */ id: string; /** * The unique identifier of the app the configuration was created for */ integrationId: string; /** * The user or team ID that owns the configuration */ ownerId: string; /** * The configuration status. Optional. If not defined, assume 'ready'. */ status?: GetConfigurationsResponseBodyIntegrationsStatus | undefined; /** * An external identifier defined by the integration vendor. */ externalId?: string | undefined; /** * When a configuration is limited to access certain projects, this will contain each of the project ID it is allowed to access. If it is not defined, the configuration has full access. */ projects?: Array<string> | undefined; /** * Source defines where the configuration was installed from. It is used to analyze user engagement for integration installations in product metrics. */ source?: GetConfigurationsResponseBodyIntegrationsSource | undefined; /** * The slug of the integration the configuration is created for. */ slug: string; /** * When the configuration was created for a team, this will show the ID of the team. */ teamId?: string | null | undefined; type: GetConfigurationsResponseBodyIntegrationsType; /** * A timestamp that tells you when the configuration was updated. */ updatedAt: number; /** * The ID of the user that created the configuration. */ userId: string; /** * The resources that are allowed to be accessed by the configuration. */ scopes: Array<string>; /** * A timestamp that tells you when the configuration was disabled. Note: Configurations can be disabled when the associated user loses access to a team. They do not function during this time until the configuration is 'transferred', meaning the associated user is changed to one with access to the team. */ disabledAt?: number | undefined; /** * A timestamp that tells you when the configuration was deleted. */ deletedAt?: number | null | undefined; /** * A timestamp that tells you when the configuration deletion has been started for cases when the deletion needs to be settled/approved by partners, such as when marketplace invoices have been paid. */ deleteRequestedAt?: number | null | undefined; /** * Record when the customer initited deletion, independent of whether `deleteRequestedAt` gets set. */ customerDeleteRequestedAt?: number | null | undefined; disabledReason?: | GetConfigurationsResponseBodyIntegrationsDisabledReason | undefined; /** * Defines the installation type. - 'external' integrations are installed via the existing integrations flow - 'marketplace' integrations are natively installed: - when accepting the TOS of a partner during the store creation process - if undefined, assume 'external' */ installationType?: GetConfigurationsResponseBodyInstallationType | undefined; /** * Historical parent installation from which acceptedPolicies were inherited. This is immutable provenance, not current authorization or relationship truth. */ acceptedPoliciesInheritedFromInstallationId?: string | undefined; }; /** * The configuration status. Optional. If not defined, assume 'ready'. */ export const GetConfigurationsResponseBodyStatus = { Error: "error", Onboarding: "onboarding", Pending: "pending", Ready: "ready", Resumed: "resumed", Suspended: "suspended", Uninstalled: "uninstalled", } as const; /** * The configuration status. Optional. If not defined, assume 'ready'. */ export type GetConfigurationsResponseBodyStatus = ClosedEnum< typeof GetConfigurationsResponseBodyStatus >; /** * Source defines where the configuration was installed from. It is used to analyze user engagement for integration installations in product metrics. */ export const GetConfigurationsResponseBodySource = { Backoffice: "backoffice", Cli: "cli", DeployButton: "deploy-button", External: "external", ImportRecommendedIntegrations: "import-recommended-integrations", Marketplace: "marketplace", Oauth: "oauth", Organization: "organization", ResourceClaims: "resource-claims", V0: "v0", } as const; /** * Source defines where the configuration was installed from. It is used to analyze user engagement for integration installations in product metrics. */ export type GetConfigurationsResponseBodySource = ClosedEnum< typeof GetConfigurationsResponseBodySource >; export const GetConfigurationsResponseBodyType = { IntegrationConfiguration: "integration-configuration", } as const; export type GetConfigurationsResponseBodyType = ClosedEnum< typeof GetConfigurationsResponseBodyType >; export const GetConfigurationsResponseBodyDisabledReason = { AccountPlanDowngrade: "account-plan-downgrade", DisabledByAdmin: "disabled-by-admin", DisabledByOwner: "disabled-by-owner", FeatureNotAvailable: "feature-not-available", OriginalOwnerLeftTheTeam: "original-owner-left-the-team", OriginalOwnerRoleDowngraded: "original-owner-role-downgraded", } as const; export type GetConfigurationsResponseBodyDisabledReason = ClosedEnum< typeof GetConfigurationsResponseBodyDisabledReason >; /** * Defines the installation type. - 'external' integrations are installed via the existing integrations flow - 'marketplace' integrations are natively installed: - when accepting the TOS of a partner during the store creation process - if undefined, assume 'external' */ export const ResponseBodyInstallationType = { External: "external", Marketplace: "marketplace", } as const; /** * Defines the installation type. - 'external' integrations are installed via the existing integrations flow - 'marketplace' integrations are natively installed: - when accepting the TOS of a partner during the store creation process - if undefined, assume 'external' */ export type ResponseBodyInstallationType = ClosedEnum< typeof ResponseBodyInstallationType >; /** * The list of configurations for the authenticated user */ export type GetConfigurationsResponseBody1 = { /** * A timestamp that tells you when the configuration was installed successfully */ completedAt?: number | undefined; /** * A timestamp that tells you when the configuration was created */ createdAt?: number | undefined; /** * The unique identifier of the configuration */ id?: string | undefined; /** * The unique identifier of the app the configuration was created for */ integrationId?: string | undefined; /** * The user or team ID that owns the configuration */ ownerId?: string | undefined; /** * The configuration status. Optional. If not defined, assume 'ready'. */ status?: GetConfigurationsResponseBodyStatus | undefined; /** * An external identifier defined by the integration vendor. */ externalId?: string | undefined; /** * When a configuration is limited to access certain projects, this will contain each of the project ID it is allowed to access. If it is not defined, the configuration has full access. */ projects?: Array<string> | undefined; /** * Source defines where the configuration was installed from. It is used to analyze user engagement for integration installations in product metrics. */ source?: GetConfigurationsResponseBodySource | undefined; /** * The slug of the integration the configuration is created for. */ slug?: string | undefined; /** * When the configuration was created for a team, this will show the ID of the team. */ teamId?: string | null | undefined; type?: GetConfigurationsResponseBodyType | undefined; /** * A timestamp that tells you when the configuration was updated. */ updatedAt?: number | undefined; /** * The ID of the user that created the configuration. */ userId?: string | undefined; /** * The resources that are allowed to be accessed by the configuration. */ scopes?: Array<string> | undefined; /** * A timestamp that tells you when the configuration was disabled. Note: Configurations can be disabled when the associated user loses access to a team. They do not function during this time until the configuration is 'transferred', meaning the associated user is changed to one with access to the team. */ disabledAt?: number | undefined; /** * A timestamp that tells you when the configuration was deleted. */ deletedAt?: number | null | undefined; /** * A timestamp that tells you when the configuration deletion has been started for cases when the deletion needs to be settled/approved by partners, such as when marketplace invoices have been paid. */ deleteRequestedAt?: number | null | undefined; /** * Record when the customer initited deletion, independent of whether `deleteRequestedAt` gets set. */ customerDeleteRequestedAt?: number | null | undefined; disabledReason?: GetConfigurationsResponseBodyDisabledReason | undefined; /** * Defines the installation type. - 'external' integrations are installed via the existing integrations flow - 'marketplace' integrations are natively installed: - when accepting the TOS of a partner during the store creation process - if undefined, assume 'external' */ installationType?: ResponseBodyInstallationType | undefined; /** * Historical parent installation from which acceptedPolicies were inherited. This is immutable provenance, not current authorization or relationship truth. */ acceptedPoliciesInheritedFromInstallationId?: string | undefined; }; /** * The list of configurations for the authenticated user */ export type GetConfigurationsResponseBody = | Array<GetConfigurationsResponseBody1> | Array<GetConfigurationsResponseBody2>; /** @internal */ export const View$outboundSchema: z.ZodNativeEnum<typeof View> = z.nativeEnum( View, ); /** @internal */ export const InstallationType$outboundSchema: z.ZodNativeEnum< typeof InstallationType > = z.nativeEnum(InstallationType); /** @internal */ export type GetConfigurationsRequest$Outbound = { view: string; installationType?: string | undefined; integrationIdOrSlug?: string | undefined; teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const GetConfigurationsRequest$outboundSchema: z.ZodType< GetConfigurationsRequest$Outbound, z.ZodTypeDef, GetConfigurationsRequest > = z.object({ view: View$outboundSchema, installationType: InstallationType$outboundSchema.optional(), integrationIdOrSlug: z.string().optional(), teamId: z.string().optional(), slug: z.string().optional(), }); export function getConfigurationsRequestToJSON( getConfigurationsRequest: GetConfigurationsRequest, ): string { return JSON.stringify( GetConfigurationsRequest$outboundSchema.parse(getConfigurationsRequest), ); } /** @internal */ export const TagIds$inboundSchema: z.ZodNativeEnum<typeof TagIds> = z .nativeEnum(TagIds); /** @internal */ export const ResponseBodyIntegration$inboundSchema: z.ZodType< ResponseBodyIntegration, z.ZodTypeDef, unknown > = z.object({ name: types.string(), icon: types.string(), isLegacy: types.boolean(), flags: types.optional(z.array(types.string())), assignedBetaLabelAt: types.optional(types.number()), tagIds: types.optional(z.array(TagIds$inboundSchema)), }); export function responseBodyIntegrationFromJSON( jsonString: string, ): SafeParseResult<ResponseBodyIntegration, SDKValidationError> { return safeParse( jsonString, (x) => ResponseBodyIntegration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyIntegration' from JSON`, ); } /** @internal */ export const GetConfigurationsResponseBodyIntegrationsStatus$inboundSchema: z.ZodNativeEnum<typeof GetConfigurationsResponseBodyIntegrationsStatus> = z .nativeEnum(GetConfigurationsResponseBodyIntegrationsStatus); /** @internal */ export const GetConfigurationsResponseBodyIntegrationsSource$inboundSchema: z.ZodNativeEnum<typeof GetConfigurationsResponseBodyIntegrationsSource> = z .nativeEnum(GetConfigurationsResponseBodyIntegrationsSource); /** @internal */ export const GetConfigurationsResponseBodyIntegrationsType$inboundSchema: z.ZodNativeEnum<typeof GetConfigurationsResponseBodyIntegrationsType> = z .nativeEnum(GetConfigurationsResponseBodyIntegrationsType); /** @internal */ export const GetConfigurationsResponseBodyIntegrationsDisabledReason$inboundSchema: z.ZodNativeEnum< typeof GetConfigurationsResponseBodyIntegrationsDisabledReason > = z.nativeEnum(GetConfigurationsResponseBodyIntegrationsDisabledReason); /** @internal */ export const GetConfigurationsResponseBodyInstallationType$inboundSchema: z.ZodNativeEnum<typeof GetConfigurationsResponseBodyInstallationType> = z .nativeEnum(GetConfigurationsResponseBodyInstallationType); /** @internal */ export const GetConfigurationsResponseBody2$inboundSchema: z.ZodType< GetConfigurationsResponseBody2, z.ZodTypeDef, unknown > = z.object({ integration: z.lazy(() => ResponseBodyIntegration$inboundSchema), completedAt: types.optional(types.number()), createdAt: types.number(), id: types.string(), integrationId: types.string(), ownerId: types.string(), status: types.optional( GetConfigurationsResponseBodyIntegrationsStatus$inboundSchema, ), externalId: types.optional(types.string()), projects: types.optional(z.array(types.string())), source: types.optional( GetConfigurationsResponseBodyIntegrationsSource$inboundSchema, ), slug: types.string(), teamId: z.nullable(types.string()).optional(), type: GetConfigurationsResponseBodyIntegrationsType$inboundSchema, updatedAt: types.number(), userId: types.string(), scopes: z.array(types.string()), disabledAt: types.optional(types.number()), deletedAt: z.nullable(types.number()).optional(), deleteRequestedAt: z.nullable(types.number()).optional(), customerDeleteRequestedAt: z.nullable(types.number()).optional(), disabledReason: types.optional( GetConfigurationsResponseBodyIntegrationsDisabledReason$inboundSchema, ), installationType: types.optional( GetConfigurationsResponseBodyInstallationType$inboundSchema, ), acceptedPoliciesInheritedFromInstallationId: types.optional(types.string()), }); export function getConfigurationsResponseBody2FromJSON( jsonString: string, ): SafeParseResult<GetConfigurationsResponseBody2, SDKValidationError> { return safeParse( jsonString, (x) => GetConfigurationsResponseBody2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetConfigurationsResponseBody2' from JSON`, ); } /** @internal */ export const GetConfigurationsResponseBodyStatus$inboundSchema: z.ZodNativeEnum< typeof GetConfigurationsResponseBodyStatus > = z.nativeEnum(GetConfigurationsResponseBodyStatus); /** @internal */ export const GetConfigurationsResponseBodySource$inboundSchema: z.ZodNativeEnum< typeof GetConfigurationsResponseBodySource > = z.nativeEnum(GetConfigurationsResponseBodySource); /** @internal */ export const GetConfigurationsResponseBodyType$inboundSchema: z.ZodNativeEnum< typeof GetConfigurationsResponseBodyType > = z.nativeEnum(GetConfigurationsResponseBodyType); /** @internal */ export const GetConfigurationsResponseBodyDisabledReason$inboundSchema: z.ZodNativeEnum<typeof GetConfigurationsResponseBodyDisabledReason> = z .nativeEnum(GetConfigurationsResponseBodyDisabledReason); /** @internal */ export const ResponseBodyInstallationType$inboundSchema: z.ZodNativeEnum< typeof ResponseBodyInstallationType > = z.nativeEnum(ResponseBodyInstallationType); /** @internal */ export const GetConfigurationsResponseBody1$inboundSchema: z.ZodType< GetConfigurationsResponseBody1, z.ZodTypeDef, unknown > = z.object({ completedAt: types.optional(types.number()), createdAt: types.optional(types.number()), id: types.optional(types.string()), integrationId: types.optional(types.string()), ownerId: types.optional(types.string()), status: types.optional(GetConfigurationsResponseBodyStatus$inboundSchema), externalId: types.optional(types.string()), projects: types.optional(z.array(types.string())), source: types.optional(GetConfigurationsResponseBodySource$inboundSchema), slug: types.optional(types.string()), teamId: z.nullable(types.string()).optional(), type: types.optional(GetConfigurationsResponseBodyType$inboundSchema), updatedAt: types.optional(types.number()), userId: types.optional(types.string()), scopes: types.optional(z.array(types.string())), disabledAt: types.optional(types.number()), deletedAt: z.nullable(types.number()).optional(), deleteRequestedAt: z.nullable(types.number()).optional(), customerDeleteRequestedAt: z.nullable(types.number()).optional(), disabledReason: types.optional( GetConfigurationsResponseBodyDisabledReason$inboundSchema, ), installationType: types.optional(ResponseBodyInstallationType$inboundSchema), acceptedPoliciesInheritedFromInstallationId: types.optional(types.string()), }); export function getConfigurationsResponseBody1FromJSON( jsonString: string, ): SafeParseResult<GetConfigurationsResponseBody1, SDKValidationError> { return safeParse( jsonString, (x) => GetConfigurationsResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetConfigurationsResponseBody1' from JSON`, ); } /** @internal */ export const GetConfigurationsResponseBody$inboundSchema: z.ZodType< GetConfigurationsResponseBody, z.ZodTypeDef, unknown > = smartUnion([ z.array(z.lazy(() => GetConfigurationsResponseBody1$inboundSchema)), z.array(z.lazy(() => GetConfigurationsResponseBody2$inboundSchema)), ]); export function getConfigurationsResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetConfigurationsResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetConfigurationsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetConfigurationsResponseBody' from JSON`, ); }