@madxnl/chessur
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

Frontend SDK for madhatter apps

Setup

To use the SDK initialize it with a GraphQLClient

import { GraphQLClient } from 'graphql-request'
import { MadhatterGraphQLClient } from '@madxnl/chessur'

const client = new GraphQLClient(baseURL, options)

const madhatterGraphqlClient = new MadhatterGraphQLClient(client)

To enforce type safety you can supply Query and Mutation types.

import { Query, Mutation, MutationVariables, QueryVariables } from '@/generated/sdk'

export const madhatterGraphqlClient =
  new MadhatterGraphQLClient<
    Query,
    Mutation,
    QueryVariables,
    MutationVariables
    >(client)

The Codegen Plugin provided by the library prepares you the neccesary types.

Codegen Plugin

To use the Codegen plugin simply include it in your codegen configuration.

In codegen.yml:

...
generates:
  src/generated/sdk.ts:
    ...
    plugins:
        ...
      - '@madxnl/chessur/codegen-plugin'

Readme

Keywords

none

Package Sidebar

Install

npm i @madxnl/chessur

Weekly Downloads

31

Version

0.0.13

License

ISC

Unpacked Size

62.5 kB

Total Files

18

Last publish

Collaborators

  • gergohrubo
  • doeke
  • patrick_madx
  • funonly