An abstract method type used in the TapjawAdapter
for defining methods.
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.
The default yielding method for a TapjawAdapter
class.
Generated using TypeDoc
TapjawContract