0.4.0 • Published 2 years ago

@autoinvent/magql-query v0.4.0

Weekly downloads
16
License
BSD-3-Clause
Repository
github
Last release
2 years ago

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 */})
0.3.7

2 years ago

0.4.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

4 years ago