Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WWSrapport TypeScript client

Official TypeScript SDK for the WWSrapport API.

Official Links

Official clients:

pnpm add @wwsrapport/client
import { WwsrapportClient, type ReportResponse } from '@wwsrapport/client';

const client = new WwsrapportClient({
  apiKey: process.env.WWSRAPPORT_API_KEY!,
});

const report: ReportResponse = await client.reports.create(
  {
    address: {
      postcode: '3905RB',
      house_number: '4',
      city: 'Veenendaal',
    },
    customer_reference: 'demo-001',
  },
  'demo-001'
);

console.log(report.id, report.status);

Typed responses

The SDK exports TypeScript types for the public API contract, including:

  • property prefill responses;
  • report creation, listing and calculation responses;
  • improvement advice responses;
  • document lists;
  • usage and rulesets;
  • webhook endpoints and delivery attempts.

The runtime response stays the exact JSON returned by the API, while TypeScript gets safer autocompletion and compile-time checks.

Webhooks

import { verifyWebhookSignature, parseWebhookEvent } from '@wwsrapport/client';

const rawBody = await request.text();
const isValid = await verifyWebhookSignature(rawBody, request.headers, process.env.WWSRAPPORT_WEBHOOK_SECRET!);

if (!isValid) {
  throw new Error('Invalid webhook signature');
}

const event = parseWebhookEvent(rawBody);
console.log(event.type, event.data);

The verifier expects the WWSrapport headers:

  • WWS-Webhook-Timestamp
  • WWS-Webhook-Signature

The signature format is v1=<hex-hmac-sha256>, signed over:

{timestamp}.{raw_body}

Development

pnpm install
pnpm test

About

Official TypeScript client for the WWSrapport API, including report creation, downloads, JSON results, and webhook verification.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages