UNPKG

@opra/common

Version:
31 lines (30 loc) 2.15 kB
import type { StrictOmit, Type, TypeThunkAsync } from 'ts-gems'; import { HttpMediaType } from '../http/http-media-type.js'; import { HttpMultipartField } from '../http/http-multipart-field.js'; import type { HttpOperation } from '../http/http-operation.js'; import type { HttpOperationResponse } from '../http/http-operation-response.js'; import type { HttpParameter } from '../http/http-parameter.js'; export interface HttpOperationDecorator { (target: Object, propertyKey: string): void; Cookie(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | Type): this; Header(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this; QueryParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this; PathParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this; RequestContent(type: string | Type): this; RequestContent(options: HttpMediaType.Options): this; MultipartContent(options?: HttpMediaType.Options, subInit?: (content: MultipartContentScope) => void): this; Response(status: number | string | (number | string)[], options?: HttpOperationResponse.Options): this; UseType(...type: Type[]): this; } export interface MultipartContentScope { Field(fieldName: string | RegExp, options?: StrictOmit<HttpMultipartField.Options, 'fieldName' | 'fieldType'>): MultipartContentScope; File(fieldName: string | RegExp, options?: StrictOmit<HttpMultipartField.Options, 'fieldName' | 'fieldType'>): MultipartContentScope; } export interface HttpOperationDecoratorFactory { /** * Property decorator * @param decoratorChain * @param options */ <T extends HttpOperation.Options>(decoratorChain: Function[], options?: T): HttpOperationDecorator; } export declare function HttpOperationDecoratorFactory(decoratorChain: Function[], options?: HttpOperation.Options & Pick<HttpOperation.Metadata, 'composition' | 'compositionOptions'>): HttpOperationDecorator;