Hypertable Client Library / Exports / HypClientLib
Class: HypClientLib
Consumers of the Hypertable Client Library do so using this class.
Hierarchy
- HypClientLib
Implements
- IHypClientLib
Table of contents
Constructors
Accessors
Methods
- alertConfirm
- alertNotify
- alertPrompt
- alertToast
- cloneRecord
- createBatch
- createRecord
- createRecordWithoutSaving
- deleteRecord
- findCollection
- findFieldFromKey
- findRecord
- findRecords
- getAllRecords
- getCollection
- getCollectionById
- getRecord
- getRecords
- getView
- getViewRecords
- log
- openPreview
- openRecordPreview
- openView
- printMarkdown
- queryRecords
- saveBatch
- selectRecord
- selectRecords
- showCustomModal
- updateRecord
Constructors
constructor
• new HypClientLib(api)
Parameters
| Name | Type | 
|---|---|
| api | HypClientLibApi | 
Accessors
utils
• get utils(): Object
Get a reference to the collection of utility functions
Returns
Object
| Name | Type | 
|---|---|
| dereference | <T>( object:T) =>any | 
| log | (... message:any[]) =>never | 
| readFromClipboard | () => Promise<undefined|string> | 
| wait | ( ms:number) =>Promise<void> | 
| writeToClipboard | ( toWrite:string) =>never | 
Implementation of
IHypClientLib.utils
Methods
alertConfirm
▸ alertConfirm(message, opts?): Promise<boolean>
Display a message to the user in a styled modal, requiring them to either confirm or cancel.
Parameters
| Name | Type | Description | 
|---|---|---|
| message | string | The message to display in the modal | 
| opts? | ClientLibApiAlertOptions | Optional options to configure the title and buttons of the modal | 
Returns
Promise<boolean>
The returned promise resolves with true if the user selects the confirm option.
Implementation of
IHypClientLib.alertConfirm
alertNotify
▸ alertNotify(message, opts?): Promise<void>
Display a message to the user in a styled modal.
The returned promise resolves once they dismiss the modal.
Parameters
| Name | Type | 
|---|---|
| message | string | 
| opts? | ClientLibApiAlertOptions | 
Returns
Promise<void>
Implementation of
IHypClientLib.alertNotify
alertPrompt
▸ alertPrompt(message, opts?): Promise<undefined | string>
Prompt the user to enter some text in an input, displayed in a styled modal.
Parameters
| Name | Type | Description | 
|---|---|---|
| message | string | The message to display in the modal | 
| opts? | ClientLibApiAlertOptions | Optional options to configure the title and buttons of the modal | 
Returns
Promise<undefined | string>
The string the user entered, or undefined if the user cancelled the modal
Implementation of
IHypClientLib.alertPrompt
alertToast
▸ alertToast(message): Promise<void>
Display a short message to the user, in a non-interrupting toast pop-up (AKA candybar)
Parameters
| Name | Type | Description | 
|---|---|---|
| message | string | The message to display | 
Returns
Promise<void>
Implementation of
IHypClientLib.alertToast
cloneRecord
▸ cloneRecord(collectionId, recordId, opts?): Promise<undefined | HypRecord>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordId | string | 
| opts? | Object | 
| opts.references? | "discard"|"keep"|"clone" | 
Returns
Promise<undefined | HypRecord>
Implementation of
IHypClientLib.cloneRecord
createBatch
▸ createBatch(): HypBatch
Returns
Implementation of
IHypClientLib.createBatch
createRecord
▸ createRecord(collectionId): Promise<undefined | HypRecord>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
Returns
Promise<undefined | HypRecord>
Implementation of
IHypClientLib.createRecord
createRecordWithoutSaving
▸ createRecordWithoutSaving(collection): HypRecord
Parameters
| Name | Type | 
|---|---|
| collection | HypCollection | 
Returns
Implementation of
IHypClientLib.createRecordWithoutSaving
deleteRecord
▸ deleteRecord(collectionId, recordId): Promise<boolean>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordId | string | 
Returns
Promise<boolean>
Implementation of
IHypClientLib.deleteRecord
findCollection
▸ findCollection(collectionId): Promise<undefined | HypCollection>
Find the collection with the given ID
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
Returns
Promise<undefined | HypCollection>
Implementation of
IHypClientLib.findCollection
findFieldFromKey
▸ findFieldFromKey(collectionId, fieldKey): undefined | HypField
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| fieldKey | string | 
Returns
undefined | HypField
Implementation of
IHypClientLib.findFieldFromKey
findRecord
▸ findRecord(collectionId, recordId): Promise<undefined | HypRecord>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordId | string | 
Returns
Promise<undefined | HypRecord>
Implementation of
IHypClientLib.findRecord
findRecords
▸ findRecords(collectionId, recordIds): Promise<HypRecord[]>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordIds | string[] | 
Returns
Promise<HypRecord[]>
Implementation of
IHypClientLib.findRecords
getAllRecords
▸ getAllRecords(collectionId): Promise<HypRecord[]>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
Returns
Promise<HypRecord[]>
Implementation of
IHypClientLib.getAllRecords
getCollection
▸ getCollection(name): Promise<HypCollection>
Get the collection with the given name. If the collection is renamed, this call will need to be updated.
throws An error if the specified collection as not found
Parameters
| Name | Type | Description | 
|---|---|---|
| name | string | The name of the desired collection | 
Returns
Promise<HypCollection>
The specified collection
Implementation of
IHypClientLib.getCollection
getCollectionById
▸ getCollectionById(id): Promise<HypCollection>
Get the collection with the given ID.
throws An error if the specified collection is not found
Parameters
| Name | Type | Description | 
|---|---|---|
| id | string | The ID of the desired collection | 
Returns
Promise<HypCollection>
The specified collection
Implementation of
IHypClientLib.getCollectionById
getRecord
▸ getRecord(collectionId, recordId): Promise<HypRecord>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordId | string | 
Returns
Promise<HypRecord>
Implementation of
IHypClientLib.getRecord
getRecords
▸ getRecords(collectionId, recordIds): Promise<HypRecord[]>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordIds | string[] | 
Returns
Promise<HypRecord[]>
getView
▸ getView(viewId): Promise<undefined | HypView>
Get the View with the given ID. Returns undefined if the View was not found.
Parameters
| Name | Type | 
|---|---|
| viewId | string | 
Returns
Promise<undefined | HypView>
Implementation of
IHypClientLib.getView
getViewRecords
▸ getViewRecords(viewId): Promise<undefined | HypRecord[]>
Get the Records visible in the given View. Returns undefined if the View was not found, or if the View is not a "collection" View.
Parameters
| Name | Type | Description | 
|---|---|---|
| viewId | string | The ID of the spceified View | 
Returns
Promise<undefined | HypRecord[]>
Implementation of
IHypClientLib.getViewRecords
log
▸ log(message, level?): void
Log a message to the Hypertable custom function log
Parameters
| Name | Type | Description | 
|---|---|---|
| message | string | The message string to log | 
| level? | ClientLibApiLogLevel | The logging level/severity (default: "LOG") | 
Returns
void
Implementation of
IHypClientLib.log
openPreview
▸ openPreview(record): Promise<boolean>
Open the specified record in the record preview modal
Parameters
| Name | Type | 
|---|---|
| record | HypRecord | 
Returns
Promise<boolean>
Implementation of
IHypClientLib.openPreview
openRecordPreview
▸ openRecordPreview(collectionId, recordId): Promise<boolean>
Open the specified record in the record preview modal
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordId | string | 
Returns
Promise<boolean>
Implementation of
IHypClientLib.openRecordPreview
openView
▸ openView(viewId, recordId?): Promise<boolean>
Immediately open the specified View
Parameters
| Name | Type | Description | 
|---|---|---|
| viewId | string | The View to open | 
| recordId? | string | Specify a record to select if the View is a Record View | 
Returns
Promise<boolean>
Whether the specified View was opened
Implementation of
IHypClientLib.openView
printMarkdown
▸ printMarkdown(markdown, options?): Promise<any>
Parameters
| Name | Type | 
|---|---|
| markdown | string | 
| options? | any | 
Returns
Promise<any>
Implementation of
IHypClientLib.printMarkdown
queryRecords
▸ queryRecords(collectionId, query): Promise<HypRecord[]>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| query | any | 
Returns
Promise<HypRecord[]>
Implementation of
IHypClientLib.queryRecords
saveBatch
▸ saveBatch(batch): Promise<boolean>
Parameters
| Name | Type | 
|---|---|
| batch | HypBatch | 
Returns
Promise<boolean>
Implementation of
IHypClientLib.saveBatch
selectRecord
▸ selectRecord(collectionId): Promise<undefined | HypRecord>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
Returns
Promise<undefined | HypRecord>
Implementation of
IHypClientLib.selectRecord
selectRecords
▸ selectRecords(collectionId): Promise<undefined | HypRecord[]>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
Returns
Promise<undefined | HypRecord[]>
Implementation of
IHypClientLib.selectRecords
showCustomModal
▸ showCustomModal(customViewId, opts?): Promise<boolean>
Parameters
| Name | Type | 
|---|---|
| customViewId | string | 
| opts? | ClientLibApiAlertOptions | 
Returns
Promise<boolean>
Implementation of
IHypClientLib.showCustomModal
updateRecord
▸ updateRecord(collectionId, recordId, patch): Promise<boolean>
Parameters
| Name | Type | 
|---|---|
| collectionId | string | 
| recordId | string | 
| patch | Object | 
Returns
Promise<boolean>
Implementation of
IHypClientLib.updateRecord
