(core) Update Plugin API documentation

Summary: Updates to Plugin API documentation.

Test Plan: Tested manually in grist-help.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D3447
This commit is contained in:
George Gevoian
2022-05-24 13:22:41 -07:00
parent 3ad2d9212e
commit 3d3a5e334a
6 changed files with 100 additions and 30 deletions

View File

@@ -69,7 +69,7 @@ export interface GristAPI {
}
/**
* Allows getting information from and nteracting with the Grist document to which a plugin or widget is attached.
* Allows getting information from and interacting with the Grist document to which a plugin or widget is attached.
*/
export interface GristDocAPI {
/**
@@ -83,19 +83,20 @@ export interface GristDocAPI {
listTables(): Promise<string[]>;
/**
* Returns a complete table of data in the format {colId: [values]}, including the 'id' column.
* Do not modify the returned arrays in-place, especially if used directly (not over RPC).
* TODO: return type is Promise{[colId: string]: CellValue[]}> but cannot be specified because
* ts-interface-builder does not properly support index-signature.
* Returns a complete table of data as [[RowRecords]], including the
* 'id' column. Do not modify the returned arrays in-place, especially if used
* directly (not over RPC).
*/
fetchTable(tableId: string): Promise<any>;
// TODO: return type is Promise{[colId: string]: CellValue[]}> but cannot be specified
// because ts-interface-builder does not properly support index-signature.
/**
* Applies an array of user actions.
* TODO: return type should be Promise<ApplyUAResult>, but this requires importing modules from
* `app/common` which is not currently supported by the build.
*/
applyUserActions(actions: any[][], options?: any): Promise<any>;
// TODO: return type should be Promise<ApplyUAResult>, but this requires importing
// modules from `app/common` which is not currently supported by the build.
}
/**
@@ -104,15 +105,17 @@ export interface GristDocAPI {
export interface GristView {
/**
* Like [[GristDocAPI.fetchTable]], but gets data for the custom section specifically, if there is any.
* TODO: return type is Promise{[colId: string]: CellValue[]}> but cannot be specified because
* ts-interface-builder does not properly support index-signature.
*/
fetchSelectedTable(): Promise<any>;
// TODO: return type is Promise{[colId: string]: CellValue[]}> but cannot be specified
// because ts-interface-builder does not properly support index-signature.
/**
* Similar TODO to `fetchSelectedTable()` for return type.
* Fetches selected record by its `rowId`.
*/
fetchSelectedRecord(rowId: number): Promise<any>;
// TODO: return type is Promise{[colId: string]: CellValue}> but cannot be specified
// because ts-interface-builder does not properly support index-signature.
/**
* Allow custom widget to be listed as a possible source for linking with SELECT BY.