@jupyterlab/services
Version:
Client APIs for the Jupyter services REST APIs
116 lines (115 loc) • 3.74 kB
TypeScript
import { ServerConnection } from '../serverconnection';
import { PromiseDelegate } from '@lumino/coreutils';
/**
* The nbconvert API service manager.
*/
export declare class NbConvertManager implements NbConvert.IManager {
/**
* Create a new nbconvert manager.
*/
constructor(options?: NbConvertManager.IOptions);
/**
* The server settings used to make API requests.
*/
readonly serverSettings: ServerConnection.ISettings;
/**
* Fetch and cache the export formats from the expensive nbconvert handler.
*/
protected fetchExportFormats(): Promise<NbConvert.IExportFormats>;
/**
* Get the list of export formats, preferring pre-cached ones.
*/
getExportFormats(force?: boolean): Promise<NbConvert.IExportFormats>;
/**
* Export a notebook to a given format.
*
* @param options - The export options.
* @param options.format - The export format (e.g., 'html', 'pdf').
* @param options.path - The path to the notebook to export.
* @param options.exporterOptions.download - Whether to download the file or open it in a new tab. Defaults to false.
*/
exportAs(options: NbConvert.IExportOptions): Promise<void>;
protected _requestingFormats: PromiseDelegate<NbConvert.IExportFormats> | null;
protected _exportFormats: NbConvert.IExportFormats | null;
}
/**
* A namespace for `NbConvertManager` statics.
*/
export declare namespace NbConvertManager {
/**
* The instantiation options for a nbconvert manager.
*/
interface IOptions {
/**
* The server settings used to make API requests.
*/
serverSettings?: ServerConnection.ISettings;
}
/**
* The interface for the export formats.
*
* @deprecated Kept for backward compatibility, use `NbConvert.IExportFormats` instead.
*/
interface IExportFormats extends NbConvert.IExportFormats {
}
}
/**
* A namespace for nbconvert API interfaces.
*/
export declare namespace NbConvert {
/**
* The interface for the export formats.
*/
interface IExportFormats {
/**
* The list of supported export formats.
*/
[key: string]: {
output_mimetype: string;
};
}
/**
* The interface for the nbconvert export options.
*/
interface IExportOptions {
/**
* The export format (e.g., 'html', 'pdf').
*/
format: string;
/**
* The path to the notebook to export.
*/
path: string;
/**
* Additional options for the exporter.
*/
exporterOptions?: {
[key: string]: any;
};
}
/**
* The interface for the nbconvert manager.
*/
interface IManager {
/**
* The server settings used to make API requests.
*/
readonly serverSettings: ServerConnection.ISettings;
/**
* Get the list of export formats.
*
* @param force - Whether to force a refresh or use cached formats if available.
* @returns A promise that resolves with the list of export formats.
*/
getExportFormats(force?: boolean): Promise<NbConvert.IExportFormats>;
/**
* Export a notebook to a given format.
*
* @param options - The export options.
* @param options.format - The export format (e.g., 'html', 'pdf').
* @param options.path - The path to the notebook to export.
* @param exporterOptions.download - Whether to download the file or open it in a new tab. Defaults to false.
*/
exportAs?(options: NbConvert.IExportOptions): Promise<void>;
}
}