@autoinvent/magql-query
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

magql-query

npm version

A library for building and sending queries to a magql-generated GraphQL API.

Docs

View the docs here

Installation

yarn add @autoinvent/magql-query

With npm:

npm install --save @autoinvent/magql-query

Usage

IMPORTANT: This package requires the usage of conveyor-schema for creating the SchemaBuilder object to pass to the MagqlQuery constructor.

Example

import { MagqlQuery } from '@autoinvent/magql-query'
import { SchemaBuilder } from '@autoinvent/conveyor-schema'

// would also require a schema.mergeSchema(remoteSchema) with the remote (backend) schema in practice
const schema = new SchemaBuilder(schema)
const endpoint = 'your/graphql/api/endpoint'

const magqlQuery = new MagqlQuery({ schema, endpoint })

// see docs for method options
magqlQuery.buildQuery({ ... })
magqlQuery.sendRequest({ ... }).then(({ data, error }) => {/* do something */})
magqlQuery.buildAndSendRequest({ ... }).then({ data, error }) => {/* do something */})

Readme

Keywords

none

Package Sidebar

Install

npm i @autoinvent/magql-query

Weekly Downloads

18

Version

0.4.0

License

BSD-3-Clause

Unpacked Size

73.8 kB

Total Files

22

Last publish

Collaborators

  • davidism
  • m1234
  • itechify
  • trickardy
  • ccarson