fetchQueryWithPagination

Fetch data from Airstack by calling queries to the Airstack API with pagination included. If you don't need pagination, use fetchQuery instead.

Pre-requisites

  • Calling init function

Example

import { fetchQueryWithPagination } from "@airstack/node";

const { data, error, hasNextPage, hasPrevPage, getNextPage, getPrevPage } =
  await fetchQueryWithPagination(query, variables);

Function Signature

type FetchQuery = {
  data: any;
  error: any;
  hasNextPage: boolean;
  hasPrevPage: boolean;
  getNextPage: () => Promise<FetchQuery | null>;
  getPrevPage: () => Promise<FetchQuery | null>;
}

type Variables = Record<string, any>

function fetchQueryWithPagination(
  query: string,
  variables?: Variables
): Promise<FetchQuery>

Params

Responses

Last updated

Was this helpful?