UNPKG

@tsed/schema

Version:
55 lines (54 loc) 2.41 kB
import { OpenSpecSecurity, OpenSpecTag, OS3Operation } from "@tsed/openspec"; import { JsonHeader } from "../interfaces/JsonOpenSpec.js"; import { JsonMap } from "./JsonMap.js"; import { JsonParameter } from "./JsonParameter.js"; import { JsonResponse } from "./JsonResponse.js"; import { JsonSchema } from "./JsonSchema.js"; export declare class JsonMethodPath extends JsonMap<any> { method: string; path: string | RegExp; constructor(method: string, path: string | RegExp); summary(summary: string): this; description(description: string): this; } export interface JsonOperationOptions extends OS3Operation<JsonSchema, JsonParameter, JsonMap<JsonResponse>> { consumes: string[]; produces: string[]; } export declare class JsonOperation extends JsonMap<JsonOperationOptions> { #private; $kind: string; readonly operationPaths: Map<string, JsonMethodPath>; constructor(obj?: Partial<JsonOperationOptions>); get response(): JsonResponse | undefined; get status(): number; tags(tags: OpenSpecTag[]): this; addTags(tags: OpenSpecTag[]): this; summary(summary: string): this; operationId(operationId: string): this; responses(responses: JsonMap<any>): this; defaultStatus(status: number): this; getStatus(): number; setRedirection(status?: number): this; isRedirection(status?: number): boolean | 0; addResponse(statusCode: string | number, response: JsonResponse): this; getResponses(): JsonMap<JsonResponse>; getResponseOf(status: number | string): JsonResponse; ensureResponseOf(status: number | string): JsonResponse; getHeadersOf(status: number): Record<string, JsonHeader & { example: string; }>; getContentTypeOf(status: number): any; security(security: OpenSpecSecurity): this; addSecurityScopes(name: string, scopes: string[]): this; description(description: string): this; deprecated(deprecated: boolean): this; addAllowedGroupsParameter(allowedGroups: string[]): this; parameters(parameters: JsonParameter[]): this; addParameter(index: number, parameter: JsonParameter): void; consumes(consumes: string[]): this; produces(produces: string[]): this; addProduce(produce: string): void; addOperationPath(method: string, path: string | RegExp): JsonMethodPath; getAllowedOperationPath(allowedVerbs?: string[]): JsonMethodPath[]; }