Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisaCG committed Nov 20, 2024
1 parent ae54abf commit 28c2edd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { Contents } from '@jupyterlab/services';
import { PathExt } from '@jupyterlab/coreutils';

import { requestAPI } from './handler';
import { getFileType, IRegisteredFileTypes } from './token';
import { getFileType, IRegisteredFileTypes, IContentsList } from './token';

/**
* The data contents model.
*/
let data: Contents.IModel = {
name: '',
path: '',
Expand All @@ -18,13 +21,9 @@ let data: Contents.IModel = {
type: ''
};

interface IContentsList {
[fileName: string]: Contents.IModel;
}

/**
* Fetch the list of available drives.
* @returns list of drives
* @returns The list of available drives.
*/
export async function getDrivesList() {
return await requestAPI<any>('drives', 'GET');
Expand All @@ -33,6 +32,8 @@ export async function getDrivesList() {
/**
* Mount a drive by establishing a connection with it.
* @param driveName
* @param options.provider The provider of the drive to be mounted.
* @param options.region The region of the drive to be mounted.
*/
export async function mountDrive(
driveName: string,
Expand All @@ -46,6 +47,15 @@ export async function mountDrive(
return await requestAPI<any>('drives', 'POST', body);
}

/**
* Get contents of a directory or retrieve contents of a specific file.
*
* @param driveName
* @param options.path The path of object to be retrived
* @param options.path The list containing all registered file types.
*
* @returns A promise which resolves with the contents model.
*/
export async function getContents(
driveName: string,
options: { path: string; registeredFileTypes: IRegisteredFileTypes }
Expand Down
8 changes: 8 additions & 0 deletions src/token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Token } from '@lumino/coreutils';
import { Contents } from '@jupyterlab/services';

/**
* A token for the plugin that provides the list of drives.
Expand Down Expand Up @@ -33,6 +34,13 @@ export interface IDriveInfo {
mounted: boolean;
}

/**
* An interface for storing the contents of a directory.
*/
export interface IContentsList {
[fileName: string]: Contents.IModel;
}

/**
* An interface that stores the registered file type, mimetype and format for each file extension.
*/
Expand Down

0 comments on commit 28c2edd

Please sign in to comment.