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>

316 lines (290 loc) 8.97 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 { SDKValidationError } from "./sdkvalidationerror.js"; export type GetIntegrationLogDrainsRequest = { /** * 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; }; /** * The delivery log format */ export const GetIntegrationLogDrainsDeliveryFormat = { Json: "json", Ndjson: "ndjson", Protobuf: "protobuf", } as const; /** * The delivery log format */ export type GetIntegrationLogDrainsDeliveryFormat = ClosedEnum< typeof GetIntegrationLogDrainsDeliveryFormat >; /** * The sources from which logs are currently being delivered to this log drain. */ export const GetIntegrationLogDrainsSources = { Build: "build", Edge: "edge", External: "external", Firewall: "firewall", Lambda: "lambda", Redirect: "redirect", Static: "static", } as const; /** * The sources from which logs are currently being delivered to this log drain. */ export type GetIntegrationLogDrainsSources = ClosedEnum< typeof GetIntegrationLogDrainsSources >; /** * Whether the log drain was created by an integration or by a user */ export const CreatedFrom = { Integration: "integration", SelfServed: "self-served", } as const; /** * Whether the log drain was created by an integration or by a user */ export type CreatedFrom = ClosedEnum<typeof CreatedFrom>; /** * The environment of log drain */ export const GetIntegrationLogDrainsEnvironments = { Preview: "preview", Production: "production", } as const; /** * The environment of log drain */ export type GetIntegrationLogDrainsEnvironments = ClosedEnum< typeof GetIntegrationLogDrainsEnvironments >; export type GetIntegrationLogDrainsSource2 = { kind: "integration"; resourceId?: string | undefined; externalResourceId?: string | undefined; integrationId: string; integrationConfigurationId: string; }; export type GetIntegrationLogDrainsSource1 = { kind: "self-served"; }; export type GetIntegrationLogDrainsSource = | GetIntegrationLogDrainsSource1 | GetIntegrationLogDrainsSource2; export type GetIntegrationLogDrainsResponseBody = { /** * The oauth2 client application id that created this log drain */ clientId?: string | undefined; /** * The client configuration this log drain was created with */ configurationId?: string | undefined; /** * A timestamp that tells you when the log drain was created */ createdAt: number; /** * The unique identifier of the log drain. Always prefixed with `ld_` */ id: string; /** * The delivery log format */ deliveryFormat?: GetIntegrationLogDrainsDeliveryFormat | undefined; /** * The name of the log drain */ name: string; /** * The identifier of the team or user whose events will trigger the log drain */ ownerId: string; projectId?: string | null | undefined; /** * The identifier of the projects this log drain is associated with */ projectIds?: Array<string> | undefined; /** * The URL to call when logs are generated */ url: string; /** * The sources from which logs are currently being delivered to this log drain. */ sources?: Array<GetIntegrationLogDrainsSources> | undefined; /** * Whether the log drain was created by an integration or by a user */ createdFrom?: CreatedFrom | undefined; /** * The headers to send with the request */ headers?: { [k: string]: string } | undefined; /** * The environment of log drain */ environments?: Array<GetIntegrationLogDrainsEnvironments> | undefined; /** * The branch regexp of log drain */ branch?: string | undefined; /** * The sampling rate of log drain */ samplingRate?: number | undefined; source: GetIntegrationLogDrainsSource1 | GetIntegrationLogDrainsSource2; }; /** @internal */ export type GetIntegrationLogDrainsRequest$Outbound = { teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const GetIntegrationLogDrainsRequest$outboundSchema: z.ZodType< GetIntegrationLogDrainsRequest$Outbound, z.ZodTypeDef, GetIntegrationLogDrainsRequest > = z.object({ teamId: z.string().optional(), slug: z.string().optional(), }); export function getIntegrationLogDrainsRequestToJSON( getIntegrationLogDrainsRequest: GetIntegrationLogDrainsRequest, ): string { return JSON.stringify( GetIntegrationLogDrainsRequest$outboundSchema.parse( getIntegrationLogDrainsRequest, ), ); } /** @internal */ export const GetIntegrationLogDrainsDeliveryFormat$inboundSchema: z.ZodNativeEnum<typeof GetIntegrationLogDrainsDeliveryFormat> = z.nativeEnum( GetIntegrationLogDrainsDeliveryFormat, ); /** @internal */ export const GetIntegrationLogDrainsSources$inboundSchema: z.ZodNativeEnum< typeof GetIntegrationLogDrainsSources > = z.nativeEnum(GetIntegrationLogDrainsSources); /** @internal */ export const CreatedFrom$inboundSchema: z.ZodNativeEnum<typeof CreatedFrom> = z .nativeEnum(CreatedFrom); /** @internal */ export const GetIntegrationLogDrainsEnvironments$inboundSchema: z.ZodNativeEnum< typeof GetIntegrationLogDrainsEnvironments > = z.nativeEnum(GetIntegrationLogDrainsEnvironments); /** @internal */ export const GetIntegrationLogDrainsSource2$inboundSchema: z.ZodType< GetIntegrationLogDrainsSource2, z.ZodTypeDef, unknown > = z.object({ kind: types.literal("integration"), resourceId: types.optional(types.string()), externalResourceId: types.optional(types.string()), integrationId: types.string(), integrationConfigurationId: types.string(), }); export function getIntegrationLogDrainsSource2FromJSON( jsonString: string, ): SafeParseResult<GetIntegrationLogDrainsSource2, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationLogDrainsSource2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationLogDrainsSource2' from JSON`, ); } /** @internal */ export const GetIntegrationLogDrainsSource1$inboundSchema: z.ZodType< GetIntegrationLogDrainsSource1, z.ZodTypeDef, unknown > = z.object({ kind: types.literal("self-served"), }); export function getIntegrationLogDrainsSource1FromJSON( jsonString: string, ): SafeParseResult<GetIntegrationLogDrainsSource1, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationLogDrainsSource1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationLogDrainsSource1' from JSON`, ); } /** @internal */ export const GetIntegrationLogDrainsSource$inboundSchema: z.ZodType< GetIntegrationLogDrainsSource, z.ZodTypeDef, unknown > = z.union([ z.lazy(() => GetIntegrationLogDrainsSource1$inboundSchema), z.lazy(() => GetIntegrationLogDrainsSource2$inboundSchema), ]); export function getIntegrationLogDrainsSourceFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationLogDrainsSource, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationLogDrainsSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationLogDrainsSource' from JSON`, ); } /** @internal */ export const GetIntegrationLogDrainsResponseBody$inboundSchema: z.ZodType< GetIntegrationLogDrainsResponseBody, z.ZodTypeDef, unknown > = z.object({ clientId: types.optional(types.string()), configurationId: types.optional(types.string()), createdAt: types.number(), id: types.string(), deliveryFormat: types.optional( GetIntegrationLogDrainsDeliveryFormat$inboundSchema, ), name: types.string(), ownerId: types.string(), projectId: z.nullable(types.string()).optional(), projectIds: types.optional(z.array(types.string())), url: types.string(), sources: types.optional( z.array(GetIntegrationLogDrainsSources$inboundSchema), ), createdFrom: types.optional(CreatedFrom$inboundSchema), headers: types.optional(z.record(types.string())), environments: types.optional( z.array(GetIntegrationLogDrainsEnvironments$inboundSchema), ), branch: types.optional(types.string()), samplingRate: types.optional(types.number()), source: z.union([ z.lazy(() => GetIntegrationLogDrainsSource1$inboundSchema), z.lazy(() => GetIntegrationLogDrainsSource2$inboundSchema), ]), }); export function getIntegrationLogDrainsResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetIntegrationLogDrainsResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetIntegrationLogDrainsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetIntegrationLogDrainsResponseBody' from JSON`, ); }