nativemind_api_client

The pure-Dart API client of the NativeMind framework. It works for any backend that describes its operations in a registry, such as the @nativemind108/api packages. It has no Flutter dependency.

Piece What it does
NmApiOperation One operation: method, path template, and access flags. Products generate the table from their registry.
NmHttpApiClient HTTP transport. Adds default headers and the bearer token. On a 401 it renews the token once and retries once. Maps timeouts and transport failures to codes, and decodes the {error} envelope.
NmActionQueue Offline mutations, kept in order, deduplicated, and sent in batches. A rule decides which errors keep an action queued.
NmTopicEventStream Live events over a single SSE connection shared by every topic, resuming with Last-Event-ID.
nmODataFilter An OData filter subset, compiled to a predicate over rows. Useful for demo backends and caches.
final api = NmHttpApiClient('https://api.example.com',
    operations: kOperations, defaultHeaders: {'X-App': 'scout'}, refreshOperation: 'refresh_token');
api.tokens = session; // an NmAccessTokens, e.g. NmSession from nativemind_session
final page = await api.table('list_items', const NmTableQuery(page: 1, size: 50), Item.fromJson);

On web, the default client sends credentials, so an HttpOnly refresh cookie reaches the API; nmCookieRefresh is true there. On native targets the refresh token travels in the body.

License: NativeMindNONC (see LICENSE).

Libraries

nativemind_api_client
Pure-Dart API client of the NativeMind framework: the operation table of a registry-driven API, an HTTP transport with one silent token refresh, the {data, meta} / {error} envelopes, table paging, an offline action queue, live events over SSE by topic, and OData filters compiled to predicates (for local demo backends and caches).