UNPKG

@opra/common

Version:
62 lines (61 loc) 2.19 kB
import type { Combine, StrictOmit, Type } from 'ts-gems'; import { type Validator } from 'valgen'; import { OpraSchema } from '../../schema/index.js'; import type { ApiDocument } from '../api-document.js'; import { DocumentElement } from '../common/document-element.js'; import { DataType } from '../data-type/data-type.js'; import type { HttpMultipartField } from './http-multipart-field.js'; /** * @namespace HttpMediaType */ export declare namespace HttpMediaType { interface Metadata extends Partial<StrictOmit<OpraSchema.HttpMediaType, 'type' | 'multipartFields'>> { type?: Type | string; multipartFields?: HttpMultipartField.Metadata[]; } interface Options extends Partial<StrictOmit<OpraSchema.HttpMediaType, 'type' | 'multipartFields'>> { type?: Type | string; } interface InitArguments extends Combine<{ type?: DataType | string | Type; }, StrictOmit<Metadata, 'multipartFields'>> { } } /** * Type definition for HttpMediaType * @class HttpMediaType */ interface HttpMediaTypeStatic { new (parent: DocumentElement, initArgs: HttpMediaType.InitArguments): HttpMediaType; prototype: HttpMediaType; } /** * Type definition of HttpMediaType prototype * @interface HttpMediaType */ export interface HttpMediaType extends HttpMediaTypeClass { } export declare const HttpMediaType: HttpMediaTypeStatic; /** * @class HttpMediaType */ declare class HttpMediaTypeClass extends DocumentElement { readonly owner: DocumentElement; description?: string; contentType?: string | string[]; contentEncoding?: string; type?: DataType; isArray?: boolean; example?: string; examples?: Record<string, string>; multipartFields: HttpMultipartField[]; maxFields?: number; maxFieldsSize?: number; maxFiles?: number; maxFileSize?: number; maxTotalFileSize?: number; findMultipartField(fieldName: string, fieldType?: OpraSchema.HttpMultipartFieldType): HttpMultipartField | undefined; toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpMediaType; generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator; } export {};