@shadowing/sdk
v0.1.1
Published
Framework-agnostic TypeScript client for the Shadowing integration API.
Readme
@shadowing/sdk
Framework-agnostic TypeScript client for Shadowing embed sessions.
Install it independently in a host application:
npm install @shadowing/sdkimport { createShadowingClient } from "@shadowing/sdk";
const shadowing = createShadowingClient({
baseUrl: "https://shadowing.example",
embedToken,
});
const session = await shadowing.startPracticeSession();
const progress = await shadowing.getProgress(session.contentId);
const entry = await shadowing.getPracticeEntry();
const firstSegment = entry.content.transcript?.segments[0];
if (!firstSegment) throw new Error("The lesson has no transcript segments");
const attempt = await shadowing.submitAttempt(session.id, {
segmentId: firstSegment.id,
audioMimeType: "audio/webm",
audioDurationMs: 2400,
});
const assessment = await shadowing.submitAudioAssessment(
attempt.id,
recordedBlob,
"recording.webm",
);The embed token is short-lived and should be obtained by the host backend. A
permanent integration secret must never be sent to browser code. API failures
are raised as ShadowingSdkError with status and normalized code fields.
submitAudioAssessment uses a browser FormData multipart request and leaves
the Content-Type boundary to fetch.
