@xhrdev/sdk
v1.0.8
Published
<img src="https://raw.githubusercontent.com/xhrdev/media/refs/heads/master/logos/logo-wordmark.png" alt="sdk" style="width: 100%" />
Readme
@xhrdev/sdk
TypeScript SDK for the xhr.dev API
Installation
npm install --save-dev @xhrdev/sdkUsage
Basic Type Imports
import {
DatadomeCaptchaRequest,
DatadomeCaptchaResponse,
DatadomeInterstitialRequest,
DatadomeInterstitialResponse,
DatadomeTagsRequest,
DatadomeTagsResponse
} from '@xhrdev/sdk';OpenAPI Specification
Access the complete OpenAPI 3.0.3 specification:
import { openApiSpec, getOpenApiSpec } from '@xhrdev/sdk';
// Get the spec as a YAML string
console.log(openApiSpec);
// Get the spec (currently returns the string, but could be parsed)
const spec = getOpenApiSpec();Raw OpenAPI Types
Access the full OpenAPI type definitions:
import { sdk } from '@xhrdev/sdk';
// Access all paths, operations, and components
type ApiPaths = sdk.paths;
type ApiOperations = sdk.operations;
type ApiComponents = sdk.components;
// Access specific operations
type CaptchaOperation = sdk.operations['getDatadomeCaptcha'];
type InterstitialOperation = sdk.operations['postDatadomeInterstitial'];
type TagsOperation = sdk.operations['postDatadomeTags'];API Endpoints
DataDome Interstitial
- POST
/datadome/interstitial- Process interstitial challenges - GET
/datadome/captcha- Retrieve captcha challenges - POST
/datadome/tags- Process DataDome tags
Authentication
All endpoints require an API key passed in the x-xhr-api-key header.
