AI Toolkit
Modulesdata

data

Shared API types — PaginatedResponse, ErrorResponse, and more

Overview

The data module exports shared TypeScript types used across the toolkit for consistent API responses.

No peer dependencies required. Types only — no runtime code.

Types

PaginatedResponse<T>

Standard paginated response shape.

interface PaginatedResponse<T> {
  data: T[];
  pagination: {
    total: number;
    page: number;
    pageSize: number;
    totalPages: number;
    hasMore: boolean;
  };
}

ErrorResponse

Standard error response shape.

interface ErrorResponse {
  error: {
    code: string;
    message: string;
    statusCode: number;
    retryable: boolean;
    fields?: Record<string, string>;
  };
}

ApiResult<T>

Wrapper for API results that may succeed or fail.

type ApiResult<T> = { success: true; data: T } | { success: false; error: ErrorResponse['error'] };

HealthReport

Health check response type (also exported from health module).

import type { PaginatedResponse, ErrorResponse } from '@jamaalbuilds/ai-toolkit/data';
On this page

On this page