import type { Combine, StrictOmit, ThunkAsync, Type } from 'ts-gems'; import { OpraSchema } from '../../schema/index.js'; import type { ApiDocument } from '../api-document.js'; import { DataTypeMap } from '../common/data-type-map.js'; import { DocumentElement } from '../common/document-element.js'; import type { DataType } from '../data-type/data-type.js'; import type { EnumType } from '../data-type/enum-type.js'; import { type HttpOperationDecorator } from '../decorators/http-operation.decorator.js'; import type { HttpController } from './http-controller.js'; import type { HttpOperationResponse } from './http-operation-response.js'; import type { HttpParameter } from './http-parameter.js'; import type { HttpRequestBody } from './http-request-body.js'; /** * @namespace HttpOperation */ export declare namespace HttpOperation { interface Metadata extends Pick { types?: ThunkAsync[]; parameters?: HttpParameter.Metadata[]; responses?: HttpOperationResponse.Metadata[]; requestBody?: HttpRequestBody.Metadata; immediateFetch?: boolean; allowPatchOperators?: boolean; allowNullOptionals?: boolean; /** Authoring-only; never exported. See `DocumentElement#docKey`. */ docKey?: string; } interface Options extends Partial> { requestBody?: HttpRequestBody.Options; } interface InitArguments extends Combine<{ name: string; types?: DataType[]; }, Pick> { } } /** * Type definition for HttpOperation * @class HttpOperation */ export interface HttpOperationStatic { /** * Class constructor of HttpOperation * @param controller * @param args */ new (controller: HttpController, args: HttpOperation.InitArguments): HttpOperation; /** * Property decorator * @param options */ (options?: T): HttpOperationDecorator; prototype: HttpOperation; GET(options?: StrictOmit): HttpOperationDecorator; DELETE(options?: StrictOmit): HttpOperationDecorator; HEAD(options?: StrictOmit): HttpOperationDecorator; OPTIONS(options?: StrictOmit): HttpOperationDecorator; PATCH(options?: StrictOmit): HttpOperationDecorator; POST(options?: StrictOmit): HttpOperationDecorator; PUT(options?: StrictOmit): HttpOperationDecorator; QUERY(options?: StrictOmit): HttpOperationDecorator; SEARCH(options?: StrictOmit): HttpOperationDecorator; } /** * @class HttpOperation */ export interface HttpOperation extends HttpOperationClass { } /** * HttpOperation */ export declare const HttpOperation: HttpOperationStatic; /** * @class HttpOperation */ declare class HttpOperationClass extends DocumentElement { readonly owner: HttpController; readonly name: string; protected get docKeySegment(): string[]; /** What this operation itself declared, which is not always what it is * in — see the accessor below. */ protected _ownSections?: string[]; /** The sections this operation is in: its own if it named any, and * otherwise its controller's, walking up through nested controllers to * the first one that declares any. * * Resolved here rather than at each reader, because every reader wants * the same answer — the api-ui groups by it, the OpenAPI mapper writes * it out as the operation's `tags` — and a declaration one or two * controllers up is not something any of them should have to go * looking for. Declaring sections on an operation replaces the * inherited list rather than adding to it: a resource whose operations * mostly belong together usually has one or two that belong somewhere * else entirely, and "somewhere else as well" is spelled by naming * both. */ get sections(): string[] | undefined; set sections(value: string[] | undefined); method: OpraSchema.HttpMethod; title?: string; description?: string; path?: string; mergePath?: boolean; types: DataTypeMap; parameters: HttpParameter[]; responses: HttpOperationResponse[]; requestBody?: HttpRequestBody; composition?: string; compositionOptions?: Record; findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined; getFullUrl(): string; toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpOperation; } export {};