Skip to content

Abstract Class: NetworkClient ​

shared foundation for per-network clients

owns http transport, caching, rate limiting, and batching. subclasses supply networkName/baseUrl and their own endpoint methods on top of fetchAndValidate.

Constructors ​

Constructor ​

ts
new NetworkClient(options?: NetworkClientOptions): NetworkClient;

Parameters ​

ParameterType
optionsNetworkClientOptions

Returns ​

NetworkClient

Methods ​

batch() ​

ts
batch<T>(operations: T, options?: BatchOptions): Promise<{ [K in string | number | symbol]: BatchResult<Awaited<ReturnType<T[K]>>> }>;

executes operations with bounded concurrency

default: 10; override via batchConcurrency or per-call concurrency.

every operation still goes through the same rate limiter as a single call. refer to the batch requests guide for the full contract.

Type Parameters ​

Type Parameter
T extends readonly () => Promise<unknown>[]

Parameters ​

ParameterType
operationsT
options?BatchOptions

Returns ​

Promise<{ [K in string | number | symbol]: BatchResult<Awaited<ReturnType<T[K]>>> }>


clearCache() ​

ts
clearCache(): Promise<void>;

Clears the entire client cache.

Returns ​

Promise<void>


invalidate() ​

ts
invalidate(cacheKey: string): Promise<void>;

Purges a specific key from the cache.

Parameters ​

ParameterType
cacheKeystring

Returns ​

Promise<void>

Distributed under the MIT License.