import { DiagnosticResult, Type, type ModelProperty, type Program } from "@typespec/compiler"; import { PathOptions, QueryOptions } from "../generated-defs/TypeSpec.Http.js"; import { Visibility } from "./metadata.js"; import { HttpPayloadDisposition } from "./payload.js"; import { CookieParameterOptions, HeaderFieldOptions, PathParameterOptions, QueryParameterOptions } from "./types.js"; export type HttpProperty = HeaderProperty | CookieProperty | ContentTypeProperty | QueryProperty | PathProperty | StatusCodeProperty | BodyProperty | BodyRootProperty | MultipartBodyProperty | BodyPropertyProperty; export interface HttpPropertyBase { readonly property: ModelProperty; /** Path from the root of the operation parameters/returnType to the property. */ readonly path: (string | number)[]; } export interface HeaderProperty extends HttpPropertyBase { readonly kind: "header"; readonly options: HeaderFieldOptions; } export interface CookieProperty extends HttpPropertyBase { readonly kind: "cookie"; readonly options: CookieParameterOptions; } export interface ContentTypeProperty extends HttpPropertyBase { readonly kind: "contentType"; } export interface QueryProperty extends HttpPropertyBase { readonly kind: "query"; readonly options: Required; } export interface PathProperty extends HttpPropertyBase { readonly kind: "path"; readonly options: Required; } export interface StatusCodeProperty extends HttpPropertyBase { readonly kind: "statusCode"; } export interface BodyProperty extends HttpPropertyBase { readonly kind: "body"; } /** Property annotated with `@bodyIgnore` */ export interface BodyIgnoreProperty extends HttpPropertyBase { readonly kind: "bodyIgnore"; } export interface BodyRootProperty extends HttpPropertyBase { readonly kind: "bodyRoot"; } export interface MultipartBodyProperty extends HttpPropertyBase { readonly kind: "multipartBody"; } /** Property to include inside the body */ export interface BodyPropertyProperty extends HttpPropertyBase { readonly kind: "bodyProperty"; } export interface GetHttpPropertyOptions { implicitParameter?: (param: ModelProperty) => PathParameterOptions | QueryParameterOptions | undefined; /** * When true, treat `Content-Type` headers as regular headers. */ treatContentTypeAsHeader?: boolean; } /** * Walks the given input(request parameters or response) and return all the properties and where they should be included(header, query, path, body, as a body property, etc.) * * @param rootMapOut If provided, the map will be populated to link nested metadata properties to their root properties. */ export declare function resolvePayloadProperties(program: Program, type: Type, visibility: Visibility, disposition: HttpPayloadDisposition, options?: GetHttpPropertyOptions): DiagnosticResult; //# sourceMappingURL=http-property.d.ts.map