Options
All
  • Public
  • Public/Protected
  • All
Menu
namespace

TapjawContract

Index

Type aliases

GenericMethod: () => unknown

Type declaration

    • (): unknown
    • An abstract method type used in the TapjawAdapter for defining methods.

      ref

      TapjawAdapter

      Returns unknown

TapjawAdapter<T, U>: { [ P in keyof T]: TapjawAdapterCallback<U> | GenericMethod | number | boolean | string | unknown[] }

Default TapjawAdapter type, used as a link between a TapjawApiCommand and a TapjawConnector to handle incoming payloads from the TapjawConnector.

The Adapter implementation gets designed to understand the schema from a TapjawConnector response, allowing the adapter to iterate and yield each entity from the payload to a defined TapjawAdapterCallback callback on the TapjawApiCommand.

Each Adapter class created must include at least one TapjawAdapterCallback method to yield the results of the TapjawConnector payload.

For example:

class MyAdapter implements TapjawAdapter<MyAdapter, MyTapjawMessage> {
construtor(private readonly connector: TapjawConnector) {}

// TapjawAdapterCallback method...
protected async * getMesssages(): AsyncGenerator<MyTapjawMessage> {
const response = await this.connector.getSomething();
// validate response...
for (const item of response.items) {
// Yield to TapjawApiCommand configured iterator.
yield new MyAdapterMessage('...', item);
}
}

// Generic methods...
public something(): string {
return 'something';
}
}

Please refer to TapjawApiCommand to understand how a TapjawAdapter is used.

Type parameters

TapjawAdapterArguments: Record<string, unknown>
deprecated
TapjawAdapterCallback<T>: () => AsyncGenerator<T>

Type parameters

Type declaration

Generated using TypeDoc