@js-soft/frosch-work-data-pond-sdk
v0.4.10
Published
TypeScript SDK for the Frosch Work Data Pond REST API.
Readme
Frosch Work Data Pond SDK
TypeScript SDK for the Frosch Work Data Pond REST API.
Example
import { BearerTokenAuthenticator, DataPondClient } from "@js-soft/frosch-work-data-pond-sdk";
const client = DataPondClient.create({
baseUrl: "https://example.internal",
authenticator: new BearerTokenAuthenticator("your-jwt")
});
const contacts = await client.contacts.list({ page: 1, pageSize: 25 });
const groups = await client.groups.list({ search: "sales" });
const contactMessages = await client.contacts.listMessages("contact-id", { page: 1, pageSize: 10 });
const health = await client.health.get();To send an XSRF token with every SDK request, configure xsrfHeader. The default header name is X-XSRF-TOKEN; use name when a proxy expects a different header.
const client = DataPondClient.create({
baseUrl: "https://example.internal",
authenticator: new BearerTokenAuthenticator("your-jwt"),
xsrfHeader: { value: "proxy-token" }
});To use the Data Pond request correlation support, configure correlationId. The SDK sends it as X-Correlation-Id with every request.
const client = DataPondClient.create({
baseUrl: "https://example.internal",
authenticator: new BearerTokenAuthenticator("your-jwt"),
correlationId: "request-flow-1"
});The SDK also re-exports AuthScopes from the types package:
import { AuthScopes } from "@js-soft/frosch-work-data-pond-sdk";
const scopes = AuthScopes.all;
const isKnownScope = AuthScopes.isValid("contacts:read");Browser / UI5
The default package build is CommonJS for Node.js and bundlers. For direct browser usage or UI5, use the browser entry point:
sap.ui.define(["@js-soft/frosch-work-data-pond-sdk/browser"], function (DataPondSdk) {
const client = DataPondSdk.DataPondClient.create({
baseUrl: "https://example.internal",
authenticator: new DataPondSdk.BearerTokenAuthenticator("your-jwt")
});
});When loaded outside UI5, the same bundle is available as globalThis.FroschWorkDataPondSdk.
