@redseat/api-http
v0.2.1
Published
HTTP transport and RedSeat cloud control-plane adapter for @redseat/api
Maintainers
Readme
@redseat/api-http
HTTP transport and RedSeat cloud control-plane adapter for the transport-neutral
@redseat/api client.
Usage
import { ServerApi } from '@redseat/api';
import { createHttpClient } from '@redseat/api-http';
const client = createHttpClient({
server: { id: 'server-id', url: 'example.com', port: 443 },
getIdToken: async (forceRefresh) => getCurrentUserToken(forceRefresh)
});
const serverApi = new ServerApi(client);For manual composition, import HttpTransport and HttpControlPlane directly:
import { RedseatClient } from '@redseat/api';
import { HttpControlPlane, HttpTransport } from '@redseat/api-http';
const transport = new HttpTransport({ baseUrl: 'https://example.com' });
const client = new RedseatClient({
server: { id: 'server-id', url: 'example.com' },
transport,
controlPlane: new HttpControlPlane(),
getIdToken: async () => 'identity-token'
});@redseat/api-http owns Axios, SSE parsing, legacy search-stream query-token
translation, local server probing, and HTTP error normalization. Other transport
packages can depend on @redseat/api without depending on this package or Axios.
