@microsoft/kiota
Version:
npm package exposing Kiota CLI functionality to TypeScript
44 lines (43 loc) • 2.87 kB
TypeScript
import { ConsumerOperation, PluginAuthType } from "..";
import { KiotaPluginType, GeneratePluginResult } from "../types";
export interface PluginGenerationOptions {
descriptionPath: string;
outputPath: string;
pluginName: string;
operation: ConsumerOperation;
workingDirectory: string;
pluginType?: KiotaPluginType;
includePatterns?: string[];
excludePatterns?: string[];
clearCache?: boolean;
cleanOutput?: boolean;
disabledValidationRules?: string[];
noWorkspace?: boolean;
pluginAuthType?: PluginAuthType | null;
pluginAuthRefid?: string;
}
/**
* Generates a plugin based on the provided options.
*
* @param {PluginGenerationOptions} pluginGenerationOptions - The options for generating the plugin.
* @param {string} pluginGenerationOptions.openAPIFilePath - The file path to the OpenAPI specification.
* @param {string} pluginGenerationOptions.pluginName - The name of the plugin to generate.
* @param {string} pluginGenerationOptions.outputPath - The output path where the generated plugin will be saved.
* @param {ConsumerOperation} pluginGenerationOptions.operation - The operation to perform during generation.
* @param {string} pluginGenerationOptions.workingDirectory - The working directory for the generation process.
* @param {KiotaPluginType} [pluginGenerationOptions.pluginType] - The type of the plugin to generate.
* @param {string[]} [pluginGenerationOptions.includePatterns] - The patterns to include in the generation process.
* @param {string[]} [pluginGenerationOptions.excludePatterns] - The patterns to exclude from the generation process.
* @param {boolean} [pluginGenerationOptions.clearCache] - Whether to clear the cache before generation.
* @param {boolean} [pluginGenerationOptions.cleanOutput] - Whether to clean the output directory before generation.
* @param {string[]} [pluginGenerationOptions.disabledValidationRules] - The validation rules to disable during generation.
* @param {boolean} [pluginGenerationOptions.noWorkspace] - Whether to generate without a workspace.
* @param {PluginAuthType | null} [pluginGenerationOptions.pluginAuthType] - The authentication type for the plugin, if any.
* @param {string} [pluginGenerationOptions.pluginAuthRefid] - The reference ID for the plugin authentication, if any.
* @returns {Promise<KiotaResult | undefined>} A promise that resolves to a KiotaResult if successful, or undefined if not.
* @throws {Error} If an error occurs during the generation process.
*
* The function connects to Kiota and sends a request to generate a plugin using the provided options.
* It handles the response and checks for success, returning the result or throwing an error if one occurs.
*/
export declare function generatePlugin(pluginGenerationOptions: PluginGenerationOptions): Promise<GeneratePluginResult | undefined>;