Skip to content

Commit

Permalink
docs(nodejs): fully document the API (#972)
Browse files Browse the repository at this point in the history
* well, you have to start somewhere, right?

* from dusk till dawn...to fix all todos

* fix client todos

* fix secret-manager todos

* fix types todos

* fix remaining todos

* Update bindings/nodejs/lib/types/block/output/output.ts

Co-authored-by: Thoralf-M <[email protected]>

* Update bindings/nodejs/lib/types/block/output/unlock-condition.ts

Co-authored-by: Thoralf-M <[email protected]>

* Update bindings/nodejs/lib/types/block/output/unlock-condition.ts

Co-authored-by: Thoralf-M <[email protected]>

* Update bindings/nodejs/lib/types/block/output/unlock-condition.ts

Co-authored-by: Thoralf-M <[email protected]>

* Some doc comments + format

* Update bindings/nodejs/lib/types/wallet/consolidation-params.ts

Co-authored-by: Alexandcoats <[email protected]>

* Update bindings/nodejs/lib/types/wallet/transaction-options.ts

Co-authored-by: Alexandcoats <[email protected]>

* Update bindings/nodejs/lib/types/wallet/participation.ts

Co-authored-by: Alexandcoats <[email protected]>

* Update bindings/nodejs/lib/types/block/output/unlock-condition.ts

* Apply suggestions from code review

* More review suggestions

* Update bindings/nodejs/lib/types/wallet/output-params.ts

Co-authored-by: Alexandcoats <[email protected]>

* Format

* Fix comment

* udpate json comment

---------

Co-authored-by: Alexandcoats <[email protected]>
Co-authored-by: Thoralf-M <[email protected]>
Co-authored-by: Thoralf-M <[email protected]>
Co-authored-by: Brord van Wierst <[email protected]>
  • Loading branch information
5 people committed Aug 14, 2023
1 parent d86af78 commit 2aeaefa
Show file tree
Hide file tree
Showing 54 changed files with 1,386 additions and 232 deletions.
20 changes: 18 additions & 2 deletions bindings/nodejs/lib/client/client-method-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ import {
} from '../bindings';
import type { IClientOptions, __ClientMethods__ } from '../types/client';

/** The MethodHandler which sends the commands to the Rust side. */
/**
* The MethodHandler which sends the commands to the Rust side.
*/
export class ClientMethodHandler {
methodHandler: ClientMethodHandler;

/**
* @param options client options or a client method handler.
*/
constructor(options: IClientOptions | ClientMethodHandler) {
// The rust client object is not extensible
if (Object.isExtensible(options)) {
Expand All @@ -26,14 +31,25 @@ export class ClientMethodHandler {
return destroyClient(this.methodHandler);
}

/**
* Call a client method.
*
* @param method The client method.
* @returns A promise that resolves to a JSON string response holding the result of the client method.
*/
async callMethod(method: __ClientMethods__): Promise<string> {
return callClientMethodAsync(
JSON.stringify(method),
this.methodHandler,
);
}

// MQTT
/**
* Listen to MQTT events.
*
* @param topics The topics to listen to.
* @param callback The callback to be called when an MQTT event is received.
*/
async listen(
topics: string[],
callback: (error: Error, result: string) => void,
Expand Down
Loading

0 comments on commit 2aeaefa

Please sign in to comment.