UNPKG

@scalar/api-client

Version:

the open source API testing client

28 lines 1.85 kB
import type { HttpMethod } from '@scalar/helpers/http/http-methods'; import type { AvailableClient } from '@scalar/snippetz'; import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'; import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'; import { type CustomCodeSampleId } from './generate-client-options.js'; export type GenerateCodeSnippetProps = { /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */ clientId: AvailableClient | CustomCodeSampleId | undefined; /** The Content-Type header value for the request body (e.g., 'application/json'). */ contentType?: string | undefined; /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */ customCodeSamples: XCodeSample[]; /** The specific example value to use when generating the code snippet. */ example?: string | undefined; /** The HTTP method for the operation (e.g., GET, POST, PUT). */ method: HttpMethod; /** The OpenAPI operation object containing request/response details. */ operation: OperationObject; /** The API endpoint path (e.g., '/users/{id}'). */ path: string; /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */ securitySchemes?: SecuritySchemeObject[] | undefined; /** The server object defining the base URL for the API request. */ server?: ServerObject | undefined; }; /** Generate the code snippet for the selected example OR operation */ export declare const generateCodeSnippet: ({ clientId, customCodeSamples, operation, method, path, example, contentType, server, securitySchemes, }: GenerateCodeSnippetProps) => string; //# sourceMappingURL=generate-code-snippet.d.ts.map