UNPKG

@scalar/api-client

Version:

the open source API testing client

104 lines 3.46 kB
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'; import { type AvailableClients } from '@scalar/snippetz'; import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'; import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types'; export type OperationCodeSampleProps = { /** * List of all http clients formatted into option groups for the client selector */ clientOptions: ClientOptionGroup[]; /** * Pre-selected client, this will determine which client is initially selected in the dropdown * * @defaults to shell/curl or a custom sample if one is available */ selectedClient?: AvailableClients[number]; /** * Which server from the spec to use for the code example */ selectedServer?: ServerObject | undefined; /** * The selected content type from the requestBody.content, this will determine which examples are available * as well as the content type of the code example * * @defaults to the first content type if not provided */ selectedContentType?: string; /** * Example name to use for resolving example values for parameters AND requestBody * * @example "limited" * ```ts * parameters: { * name: 'foobar', * in: 'query', * examples: { * limited: { * dataValue: 10, * } * } * }, * body: { * content: { * 'application/json': { * examples: { * limited: { * dataValue: { foo: 'bar' }, * } * } * } * } * } * * ``` */ selectedExample?: string; /** * The security schemes which are applicable to this operation */ securitySchemes?: SecuritySchemeObject[]; /** * HTTP method of the operation */ method: HttpMethodType; /** * Path of the operation */ path: string; /** * De-referenced OpenAPI Operation object */ operation: OperationObject; /** * If true and there's no example, we will display a small card with the method and path only */ fallback?: boolean; /** * A method to generate the label of the block, should return an html string */ generateLabel?: () => string; /** * If true, render this as a webhook request example */ isWebhook?: boolean; }; /** * Request Example * * The core component for rendering a request example block, * this component does not have much of its own state but operates on props and custom events * * @event scalar-update-selected-client - Emitted when the selected client changes * @event scalar-update-selected-example - Emitted when the selected example changes */ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<OperationCodeSampleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<OperationCodeSampleProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, { header: () => unknown; footer: () => unknown; }>; export default _default; type __VLS_WithSlots<T, S> = T & { new (): { $slots: S; }; }; //# sourceMappingURL=OperationCodeSample.vue.d.ts.map