UNPKG

@seamapi/blueprint

Version:

Build tools for the Seam API using this blueprint.

157 lines (156 loc) 7.56 kB
import { z } from 'zod'; import type { Endpoint } from '../../lib/blueprint.js'; import { type SyntaxName } from './syntax.js'; export declare const CodeSampleDefinitionSchema: z.ZodObject<{ title: z.ZodString; description: z.ZodString; request: z.ZodObject<{ path: z.ZodString; parameters: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../lib/json.js").Json, z.ZodTypeDef, import("../../lib/json.js").Json>>>>; }, "strip", z.ZodTypeAny, { path: string; parameters: Record<string, import("../../lib/json.js").Json>; }, { path: string; parameters?: Record<string, import("../../lib/json.js").Json> | undefined; }>; response: z.ZodObject<{ body: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<import("../../lib/json.js").Json, z.ZodTypeDef, import("../../lib/json.js").Json>>>; }, "strip", z.ZodTypeAny, { body: Record<string, import("../../lib/json.js").Json> | null; }, { body: Record<string, import("../../lib/json.js").Json> | null; }>; }, "strip", z.ZodTypeAny, { description: string; title: string; request: { path: string; parameters: Record<string, import("../../lib/json.js").Json>; }; response: { body: Record<string, import("../../lib/json.js").Json> | null; }; }, { description: string; title: string; request: { path: string; parameters?: Record<string, import("../../lib/json.js").Json> | undefined; }; response: { body: Record<string, import("../../lib/json.js").Json> | null; }; }>; export type CodeSampleDefinitionInput = z.input<typeof CodeSampleDefinitionSchema>; export type CodeSampleDefinition = z.output<typeof CodeSampleDefinitionSchema>; declare const CodeSchema: z.ZodRecord<z.ZodEnum<["javascript", "python", "php", "ruby", "seam_cli", "go", "java", "csharp", "curl"]>, z.ZodObject<{ title: z.ZodString; sdkName: z.ZodEnum<["javascript", "python", "php", "ruby", "seam_cli", "go", "java", "csharp", "curl"]>; request: z.ZodString; response: z.ZodString; request_syntax: z.ZodEnum<["javascript", "json", "python", "php", "ruby", "bash", "go", "java", "csharp"]>; response_syntax: z.ZodEnum<["javascript", "json", "python", "php", "ruby", "bash", "go", "java", "csharp"]>; }, "strip", z.ZodTypeAny, { title: string; sdkName: "javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl"; request: string; response: string; request_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; response_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; }, { title: string; sdkName: "javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl"; request: string; response: string; request_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; response_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; }>>; export type Code = z.infer<typeof CodeSchema>; declare const _CodeSampleSchema: z.ZodObject<{ title: z.ZodString; description: z.ZodString; request: z.ZodObject<{ path: z.ZodString; parameters: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../lib/json.js").Json, z.ZodTypeDef, import("../../lib/json.js").Json>>>>; }, "strip", z.ZodTypeAny, { path: string; parameters: Record<string, import("../../lib/json.js").Json>; }, { path: string; parameters?: Record<string, import("../../lib/json.js").Json> | undefined; }>; response: z.ZodObject<{ body: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<import("../../lib/json.js").Json, z.ZodTypeDef, import("../../lib/json.js").Json>>>; }, "strip", z.ZodTypeAny, { body: Record<string, import("../../lib/json.js").Json> | null; }, { body: Record<string, import("../../lib/json.js").Json> | null; }>; } & { code: z.ZodRecord<z.ZodEnum<["javascript", "python", "php", "ruby", "seam_cli", "go", "java", "csharp", "curl"]>, z.ZodObject<{ title: z.ZodString; sdkName: z.ZodEnum<["javascript", "python", "php", "ruby", "seam_cli", "go", "java", "csharp", "curl"]>; request: z.ZodString; response: z.ZodString; request_syntax: z.ZodEnum<["javascript", "json", "python", "php", "ruby", "bash", "go", "java", "csharp"]>; response_syntax: z.ZodEnum<["javascript", "json", "python", "php", "ruby", "bash", "go", "java", "csharp"]>; }, "strip", z.ZodTypeAny, { title: string; sdkName: "javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl"; request: string; response: string; request_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; response_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; }, { title: string; sdkName: "javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl"; request: string; response: string; request_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; response_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; }>>; }, "strip", z.ZodTypeAny, { code: Partial<Record<"javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl", { title: string; sdkName: "javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl"; request: string; response: string; request_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; response_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; }>>; description: string; title: string; request: { path: string; parameters: Record<string, import("../../lib/json.js").Json>; }; response: { body: Record<string, import("../../lib/json.js").Json> | null; }; }, { code: Partial<Record<"javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl", { title: string; sdkName: "javascript" | "python" | "php" | "ruby" | "seam_cli" | "go" | "java" | "csharp" | "curl"; request: string; response: string; request_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; response_syntax: "javascript" | "python" | "php" | "ruby" | "go" | "java" | "csharp" | "json" | "bash"; }>>; description: string; title: string; request: { path: string; parameters?: Record<string, import("../../lib/json.js").Json> | undefined; }; response: { body: Record<string, import("../../lib/json.js").Json> | null; }; }>; export type CodeSample = z.output<typeof _CodeSampleSchema>; export interface CodeSampleContext { endpoint: Omit<Endpoint, 'codeSamples'>; formatCode: (content: string, syntax: SyntaxName) => Promise<string>; } export declare const createCodeSample: (codeSampleDefinition: CodeSampleDefinition, context: CodeSampleContext) => Promise<CodeSample>; export {};