antd-crud-table API
    Preparing search index...

    Interface RestDataSourceOptions<T, K>

    Everything needed to point a RestDataSource at an API.

    interface RestDataSourceOptions<T, K extends keyof T = keyof T> {
        baseUrl?: string;
        configureRequest?: (
            context: RestRequestContext<T, K>,
        ) => RestRequestOverrides | Promise<RestRequestOverrides>;
        endpoints?: Partial<RestEndpoints>;
        fetchImpl?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        headers?: Readonly<Record<string, string>>;
        init?: Omit<RequestInit, "method" | "body" | "headers">;
        methods?: Partial<RestMethods>;
        paramNames?: Partial<RestParamNames>;
        parseRecord?: (payload: unknown, context: RestRequestContext<T, K>) => T;
        parseResponse?: (payload: unknown) => CrudPage<T>;
        query?: Readonly<Record<string, RestQueryValue>>;
        serializeRequest?: (
            draft: CrudDraft<T>,
            context: RestRequestContext<T, K>,
        ) => unknown;
    }

    Type Parameters

    • T
    • K extends keyof T = keyof T
    Index
    baseUrl?: string

    Prefixed to every request path, exactly once.

    configureRequest?: (
        context: RestRequestContext<T, K>,
    ) => RestRequestOverrides | Promise<RestRequestOverrides>

    Adjusts a request as it is made.

    Runs per call and may be async, so it covers what static options cannot: a rotating or awaited token, a header only one operation sends, a verb chosen from the payload. Its result is merged over the static options.

    endpoints?: Partial<RestEndpoints>

    Overrides for the per-operation paths.

    fetchImpl?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    Injected for testing; defaults to the global fetch.

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    headers?: Readonly<Record<string, string>>

    Sent with every request, merged over the default content type.

    init?: Omit<RequestInit, "method" | "body" | "headers">

    Passed through to fetch on every request.

    This is where credentials: 'include' for cookie auth lives, along with mode, cache, redirect and a long-lived signal.

    methods?: Partial<RestMethods>

    Overrides for the HTTP verb used by each mutating operation.

    paramNames?: Partial<RestParamNames>

    Overrides for query-parameter names, for APIs with another vocabulary.

    parseRecord?: (payload: unknown, context: RestRequestContext<T, K>) => T

    Maps a create or update response onto the stored record.

    The inbound counterpart to serializeRequest. Without it a write response is taken as the record itself, so an API that answers { data: { ... } } hands back the envelope.

    parseResponse?: (payload: unknown) => CrudPage<T>

    Maps a list response onto a page. Required when the API wraps its payload.

    query?: Readonly<Record<string, RestQueryValue>>

    Appended to every request's query string, merged with generated parameters.

    serializeRequest?: (
        draft: CrudDraft<T>,
        context: RestRequestContext<T, K>,
    ) => unknown

    Maps a draft onto the request body. Defaults to sending the draft as-is.