Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 1.48 KB

fetchquery.md

File metadata and controls

60 lines (46 loc) · 1.48 KB
description layout
Fetch data from Airstack by calling queries to the Airstack API. If you need any pagination, use fetchQueryWithPagination instead.
title description tableOfContents outline pagination
visible
true
visible
true
visible
true
visible
visible
true

fetchQuery

Pre-requisites

  • Calling init function

Example

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

const { data, error } = await fetchQuery(query, variables);

Function Signature

type FetchQuery = {
  data: any;
  error: any;
}

type Variables = Record<string, any>

fetchQuery(
  query: string,
  variables?: Variables | undefined
): Promise<Pick<FetchQuery, "data" | "error">>

Params

Param Type Default Value Description
query string Airstack GraphQL query
variables Record<string, any> GraphQL query variables

Responses

Param Type Default Value Description
data any? Response data from GraphQL query if API call succeeds.
error any? Error logs from GraphQL query if API call failed.