@compass/api

This package provides functionalities to interact with the Compass API using GraphQL queries and mutations.

Usage

import api from "@compass/api";

API Reference

api.query(document: string, variables?: Record<string, any>)

Sends a GraphQL query to the Compass API.

  • document (required, string): The GraphQL document to send.

  • variables (optional, Record<string, any>): The variables to send with the query.

Returns a Promise that resolves with the result of the query.

api.mutate(document: string, variables?: Record<string, any>)

Sends a GraphQL mutation to the Compass API.

  • document (required, string): The GraphQL document to send.

  • variables (optional, Record<string, any>): The variables to send with the mutation.

Returns a Promise that resolves with the result of the mutation.

Examples

To send a GraphQL query:

Last updated