import { Interface, Namespace, Program } from "@typespec/compiler"; import { HttpVerb } from "@typespec/http"; import { CallableContract, CallableOperation } from "./callable.js"; export type TransportBindingKind = "path" | "query" | "header" | "cookie" | "body"; export interface TransportBinding { name: string; wireName: string; type: string; kind: TransportBindingKind; optional: boolean; } export interface TransportAuthRequirement { options: TransportAuthOption[]; } export interface TransportAuthOption { schemes: TransportAuthScheme[]; } export interface TransportAuthScheme { id: string; type: string; description?: string; scheme?: string; in?: "header" | "query" | "cookie"; name?: string; scopes?: string[]; flows?: TransportOAuth2Flow[]; openIdConnectUrl?: string; } export interface TransportOAuth2Flow { type: string; authorizationUrl?: string; tokenUrl?: string; refreshUrl?: string; scopes: string[]; } export interface TransportResponse { statusCodes: string[]; kind: TransportResponseKind; body?: string; contentTypes: string[]; } export type TransportResponseKind = "success" | "error" | "unknown"; export interface TransportOperation { contract: string; operation: string; callable: CallableOperation; verb: HttpVerb; path: string; uriTemplate: string; bindings: TransportBinding[]; auth?: TransportAuthRequirement; responses: TransportResponse[]; } export interface TransportContract { name: string; namespace: string; callable: CallableContract; operations: TransportOperation[]; } export declare function lowerTypeSpecTransportContracts(program: Program, namespace: Namespace, rootNamespace: string, rootAlias: string): TransportContract[]; export declare function lowerInterfaceTransportContract(program: Program, iface: Interface, rootNamespace: string, rootAlias: string): TransportContract | undefined; export declare function sortTransportBindings(bindings: readonly TransportBinding[]): TransportBinding[]; export declare function transportBindingsByKind(operation: TransportOperation, kind: TransportBindingKind): TransportBinding[]; export declare function firstSuccessStatusCode(operation: TransportOperation): number | undefined; export declare function successBodyResponses(operation: TransportOperation): TransportResponse[]; export declare function unknownBodyResponses(operation: TransportOperation): TransportResponse[]; export declare function successOrFallbackBodyResponses(operation: TransportOperation): TransportResponse[]; export declare function firstSuccessBodyResponse(operation: TransportOperation): TransportResponse | undefined; export declare function statusCodeMatches(statusCode: string, status: number): boolean; export declare function isSuccessStatusCode(statusCode: string): boolean; export declare function classifyStatusCodes(statusCodes: readonly string[]): TransportResponseKind;