@pack/client
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

@pack/client

The @pack/client package provides a client for interacting with the Pack GraphQL API.

Installation

npm install @pack/client

Usage

The client needs to be configured with your store's token, which can be found in the Pack admin under Settings > Developer > API Keys.

import { PackClient } from '@pack/client';

const packClient = new PackClient({
  token: 'YOUR_TOKEN',
  contentEnvironment: 'production' 
});

const { data, error } = await packClient.fetch(QUERY, OPTIONS);
  • QUERY - The GraphQL query string
  • OPTIONS - Optional PackFetchOptions
    • variables - Object containing any GraphQL variables

Returns a promise resolving to:

  • data - The data returned by the GraphQL API
  • error - Any error that occurred, with additional info

Development

# install dependencies
yarn

# build package
yarn build

# test package
yarn test

Readme

Keywords

none

Package Sidebar

Install

npm i @pack/client

Weekly Downloads

313

Version

0.0.7

License

MIT

Unpacked Size

5.73 kB

Total Files

11

Last publish

Collaborators

  • simpleshadow
  • anguy95
  • aaronescalona
  • jeremyagabriel