UNPKG

1.48 kBTypeScriptView Raw
1import { OpenAPIObject } from './interfaces';
2import { ExternalDocumentationObject, SecurityRequirementObject, SecuritySchemeObject, ServerVariableObject } from './interfaces/open-api-spec.interface';
3export declare class DocumentBuilder {
4 private readonly logger;
5 private readonly document;
6 setTitle(title: string): this;
7 setDescription(description: string): this;
8 setVersion(version: string): this;
9 setTermsOfService(termsOfService: string): this;
10 setContact(name: string, url: string, email: string): this;
11 setLicense(name: string, url: string): this;
12 addServer(url: string, description?: string, variables?: Record<string, ServerVariableObject>): this;
13 setExternalDoc(description: string, url: string): this;
14 setBasePath(path: string): this;
15 addTag(name: string, description?: string, externalDocs?: ExternalDocumentationObject): this;
16 addSecurity(name: string, options: SecuritySchemeObject): this;
17 addSecurityRequirements(name: string | SecurityRequirementObject, requirements?: string[]): this;
18 addBearerAuth(options?: SecuritySchemeObject, name?: string): this;
19 addOAuth2(options?: SecuritySchemeObject, name?: string): this;
20 addApiKey(options?: SecuritySchemeObject, name?: string): this;
21 addBasicAuth(options?: SecuritySchemeObject, name?: string): this;
22 addCookieAuth(cookieName?: string, options?: SecuritySchemeObject, securityName?: string): this;
23 build(): Omit<OpenAPIObject, 'paths'>;
24}