ReadApi<TClient> Class
Outputs metadata for information from any API with its client.
Namespace
Statiq.Core
Interfaces
Base Types
graph BT Type-->Base0["ParallelModule"] click Base0 "/api/Statiq.Common/ParallelModule" Base0-->Base1["Module"] click Base1 "/api/Statiq.Common/Module" Base1-->Base2["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type-.->Interface1["IParallelModule"] click Interface1 "/api/Statiq.Common/IParallelModule" Type-.->Interface2["IDisposable"] Type["ReadApi<TClient>"] class Type type-node

Syntax

public class ReadApi<TClient> : ParallelModule, IModule, IParallelModule, IDisposable 
    where TClient : class

Remarks

This modules used to submit requests to the API with the API client. Because of the possible large number of different kinds of requests, this module does not attempt to provide a fully abstract wrapper around the API. Instead, it simplifies the housekeeping involved in setting up an API client and requires you to provide functions that fetch whatever data you need. Each request will be sent for each input document.

Type Parameters

Name Description
TClient

Constructors

Name Summary
ReadApi(Config<TClient>, bool, string) Creates a connection to the API using the client factory.
ReadApi(Config<TClient>, string) Creates a connection to the API using the client factory.
ReadApi(TClient, string) Creates a connection to the API using the client.

Properties

Name Property Type Summary
Parallel bool
Indicates whether documents will be processed by this module in parallel.
Inherited from ParallelModule

Methods

Name Return Value Summary
AfterExecution(IExecutionContext, ExecutionOutputs) void
Called after each module execution.
Inherited from Module
AfterExecutionAsync(IExecutionContext, ExecutionOutputs) Task
Called after each module execution.
Inherited from Module
BeforeExecution(IExecutionContext) void
Called before each module execution.
Inherited from Module
BeforeExecutionAsync(IExecutionContext) Task
Called before each module execution.
Inherited from Module
Dispose() void
Dispose API client resources.
ExecuteAsync(IExecutionContext) Task<IEnumerable<IDocument>>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
ExecuteContextAsync(IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module once for all input documents.
Inherited from ParallelModule
ExecuteInputAsync(IDocument, IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module.
ExecuteRequestAsync(Func<IDocument, IExecutionContext, TClient, Task<IEnumerable<KeyValuePair<string, object>>>>, IDocument, IExecutionContext, TClient) Task<IEnumerable<KeyValuePair<string, object>>>
This should be overridden in derived classes to provide preparation for each request if needed.
Finally(IExecutionContext) void
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
FinallyAsync(IExecutionContext) Task
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
WithClientInitialization(Action<IDocument, IExecutionContext, TClient>) ReadApi<TClient>
Initialize the API client.
WithClientInitialization(Action<IExecutionContext, TClient>) ReadApi<TClient>
Initialize the API client.
WithClientInitialization(Action<TClient>) ReadApi<TClient>
Initialize the API client.
WithRequest(Func<IDocument, IExecutionContext, TClient, IEnumerable<KeyValuePair<string, object>>>) ReadApi<TClient>
Submits a request to the API. This allows you to incorporate data from the execution context and current document in your request.
WithRequest(Func<IDocument, IExecutionContext, TClient, Task<IEnumerable<KeyValuePair<string, object>>>>) ReadApi<TClient>
Submits a request to the API. This allows you to incorporate data from the execution context and current document in your request.
WithRequest(Func<IExecutionContext, TClient, IEnumerable<KeyValuePair<string, object>>>) ReadApi<TClient>
Submits a request to the API client. This allows you to incorporate data from the execution context in your request.
WithRequest(Func<IExecutionContext, TClient, Task<IEnumerable<KeyValuePair<string, object>>>>) ReadApi<TClient>
Submits a request to the API client. This allows you to incorporate data from the execution context in your request.
WithRequest(string, Func<IDocument, IExecutionContext, TClient, object>) ReadApi<TClient>
Submits a request to the API. This allows you to incorporate data from the execution context and current document in your request.
WithRequest(string, Func<IDocument, IExecutionContext, TClient, Task<object>>) ReadApi<TClient>
Submits a request to the API. This allows you to incorporate data from the execution context and current document in your request.
WithRequest(string, Func<IExecutionContext, TClient, object>) ReadApi<TClient>
Submits a request to the API client. This allows you to incorporate data from the execution context in your request.
WithRequest(string, Func<IExecutionContext, TClient, Task<object>>) ReadApi<TClient>
Submits a request to the API client. This allows you to incorporate data from the execution context in your request.
WithRequestDelay(int) ReadApi<TClient>
Submits the requests delay for each request in the current instance of module.
WithRequestLimit(int) ReadApi<TClient>
Submits the limit of executing requests.

Extension Methods