Skip to main content

nativemind_api_client 0.2.0 copy "nativemind_api_client: ^0.2.0" to clipboard
nativemind_api_client: ^0.2.0 copied to clipboard

Pure-Dart API client of the NativeMind framework: operation table, HTTP transport with silent token refresh, error envelope, paging, offline action queue, SSE topic stream, OData filters.

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).

0
likes
140
points
0
downloads

Documentation

API reference

Publisher

verified publisherframework.nativemind.net

Weekly Downloads

Pure-Dart API client of the NativeMind framework: operation table, HTTP transport with silent token refresh, error envelope, paging, offline action queue, SSE topic stream, OData filters.

Repository (GitLab)

Topics

#api #http #sse #offline #client

License

unknown (license)

Dependencies

http, web

More

Packages that depend on nativemind_api_client