import { RouteMeta } from '@novice1/routing'; import { DocGenerator, ProcessedRoute } from '../commons'; import { Auth, AuthAttribute, CollectionVersion, Description, EventObject, Folder, InfoObject, Item, Variable } from './postman/definitions'; import { PostmanHelperInterface } from './postman/helpers/interfaces'; import { BasePostmanAuthUtil } from '../utils/auth/baseAuthUtils'; export interface PostmanCollection { info: InfoObject; item: (Item | Folder)[]; event?: EventObject[]; variable?: Variable[]; auth?: Auth | null; protocolProfileBehavior?: unknown; [key: string]: unknown; } export declare enum GenerateFoldersRule { siblings = "siblings", levels = "levels" } export type PostmanHelperClass = { new (args: { isRoot?: boolean; value: unknown; }): PostmanHelperInterface; }; export type PostmanOptions = { helperClass?: PostmanHelperClass; helperSchemaProperty?: string; }; /** * * Postman collection generator. * * @note For now it is not possible to only * send files outside of object property (multipart). * Well, at least not tried yet * but it definitely doesn't work with alternatives */ export declare class Postman implements DocGenerator { #private; constructor(options?: PostmanOptions); setGenerateFoldersRule(v: GenerateFoldersRule): Postman; getGenerateFoldersRule(): GenerateFoldersRule; setResponsesProperty(v: string): Postman; getResponsesProperty(): string | undefined; setConsumes(consumes: string[]): Postman; getConsumes(): string[]; setHost(host: string): Postman; setHost(host: string[]): Postman; getHost(): string[]; addHost(host: string): Postman; setInfo(info: InfoObject): Postman; getInfo(): InfoObject; setInfoProperty(prop: string, v: unknown): Postman; setName(name: string): Postman; getName(): string; setPostmanId(postmanId: string): Postman; getPostmanId(): string | undefined; setDescription(description: Description): Postman; getDescription(): Description | undefined; setVersion(version: CollectionVersion | string | undefined): Postman; getVersion(): CollectionVersion | string | undefined; setSchema(schema: string): Postman; getSchema(): string; setVariableList(variableList: Variable[]): Postman; getVariableList(): Variable[] | undefined; addVariable(variable: Variable): Postman; setEventList(eventList: EventObject[]): Postman; getEventList(): EventObject[] | undefined; addEvent(event: EventObject): Postman; /** * Example: * ```ts * postman.setAuth({ * type: 'basic', * basic: [] * }); * ``` */ setAuth(auth: Auth | null): Postman; /** * Example: * ```ts * postman.setAuth('basic', []); * ``` */ setAuth(type: string, auth?: AuthAttribute[]): Postman; /** * {@include ../../typedocIncludes/postman.setAuth.1.md} */ setAuth(auth: BasePostmanAuthUtil): Postman; getAuth(): Auth | null | undefined; setProtocolProfileBehavior(protocolProfileBehavior: unknown): Postman; getProtocolProfileBehavior(): unknown; setFolders(folders: Folder[]): Postman; getFolders(): Folder[]; addFolder(name: string): Postman; addFolder(folder: Folder): Postman; addFolders(name: string): Postman; addFolders(folder: Folder): Postman; addFolders(folders: Folder[]): Postman; /** * {@include ../../typedocIncludes/postman.setDefaultSecurity.1.md} */ setDefaultSecurity(auth: BasePostmanAuthUtil): Postman; /** * Example: * ```ts * postman.setDefaultSecurity({ * type: 'basic', * basic: [] * }); * ``` */ setDefaultSecurity(auth: Auth): Postman; /** * Example: * ```ts * postman.setDefaultSecurity('basic'); * ``` */ setDefaultSecurity(type: string): Postman; getDefaultSecurity(): Auth | undefined; removeDefaultSecurity(): Auth | undefined; /** * @example * ```typescript * import routing from '@novice1/routing'; * import { Postman } from '@novice1/api-doc-generator'; * * const router = routing().post(...); * const postman = new Postman(); * const routes = postman.add(router.getMeta()); * const { path, method, schema } = routes[0]; * ``` * @returns The added/updated routes */ add(routes: RouteMeta[]): ProcessedRoute[]; add(routes: RouteMeta): ProcessedRoute[]; /** * remove all routes * @returns The removed routes */ removeAll(): ProcessedRoute[]; private _getResponsesSchema; private _add; private _formatResponses; private _formatRequestBody; private _formatHeader; private _formatUrl; private _formatUrlVariable; private _formatUrlQuery; private _pushRequestBody; private _pushHeader; private _pushVariable; private _pushQueryParam; result(): PostmanCollection; }