Skip to content

Commit

Permalink
add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Nov 7, 2024
1 parent 8a08b3c commit b527451
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions packages/docprovider/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,74 @@ export interface IForkChangedEvent {
username?: string;
}

/**
* Interface representing a Fork Manager that manages forked documents and
* provides signals for fork-related events.
*
* @interface IForkManager
* @extends IDisposable
*/
export interface IForkManager extends IDisposable {
/**
* Creates a new fork for a given document.
*
* @param options.rootId - The ID of the root document to fork.
* @param options.synchronize - A flag indicating whether the fork should be kept
* synchronized with the root document.
* @param options.label - An optional label for the fork.
* @param options.description - An optional description for the fork.
*
* @returns A promise that resolves to an `IForkCreationResponse` if the fork
* is created successfully, or `undefined` if the creation fails.
*/

createFork(options: {
rootId: string;
synchronize: boolean;
label?: string;
description?: string;
}): Promise<IForkCreationResponse | undefined>;

/**
* Retrieves all forks associated with a specific document.
*
* @param documentId - The ID of the document for which forks are to be retrieved.
*
* @returns A promise that resolves to an `IAllForksResponse` containing information about all forks.
*/
getAllForks(documentId: string): Promise<IAllForksResponse>;

/**
* Deletes a specified fork and optionally merges its changes.
*
* @param options - Options for deleting the fork.
* @param options.forkId - The ID of the fork to be deleted.
* @param options.merge - A flag indicating whether changes from the fork should be merged back into the root document.
*
* @returns A promise that resolves when the fork is successfully deleted.
*/
deleteFork(options: { forkId: string; merge: boolean }): Promise<void>;

/**
* Signal emitted when a new fork is added.
*
* @event forkAdded
* @type ISignal<IForkManager, IForkChangedEvent>
*/
forkAdded: ISignal<IForkManager, IForkChangedEvent>;

/**
* Signal emitted when a fork is deleted.
*
* @event forkDeleted
* @type ISignal<IForkManager, IForkChangedEvent>
*/
forkDeleted: ISignal<IForkManager, IForkChangedEvent>;
}

/**
* Token providing a fork manager instance.
*/
export const IForkManagerToken = new Token<IForkManager>(
'@jupyter/docprovider:IForkManagerToken'
);

0 comments on commit b527451

Please sign in to comment.