@yantrix/automata v0.1.0 • Docs
Yantrix API / @yantrix/automata / createHTTPRequestAdapter
Function: createHTTPRequestAdapter()
ts
function createHTTPRequestAdapter<EventType, EventMetaType>(opts): [IDataSource<EventType, EventMetaType, THTTPRequestAdapterOutput>, IDataDestination<EventType, EventMetaType, null, THTTPRequestAdapterInput, THTTPRequestAdapterOutput>]
Creates a Data Source and a Data Destination that are connected by a list of HTTP Requests, each initiated by a certain event
Type Parameters
• EventType extends number
• EventMetaType extends Record
<EventType
, any
>
Parameters
• opts
• opts.id?: string
An optional id for the Data Source and Data Destination
• opts.routes: Partial
<{ [K in number]: [Function, Function] }
>
An object with event names as keys and an array with the request options and the response mapper as values
Returns
[IDataSource
<EventType
, EventMetaType
, THTTPRequestAdapterOutput
>, IDataDestination
<EventType
, EventMetaType
, null
, THTTPRequestAdapterInput
, THTTPRequestAdapterOutput
>]
- An array with the Data Source and the Data Destination