1.4.3 • Published 2 years ago

spirit-link v1.4.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

spirit-link - W
Enchantment - Aura
Enchant package.json
Whenever enchanted project sends bits to EventLink, its controller regains that much time.

spirit-link - A library for interacting with EventLink more easily

This abstracts away the majority of the GraphQL and authorization steps to interact with EventLink, and provides many helper functions for common actions you may want to perform in a way that keeps you from writing any GraphQL yourself. Of course, if you want to do that, you certainly still can - but this should make your life a lot easier when dealing with keeping the auth up to date.

Installation

@apollo/client is required as a peer dependency, so you probably want to run:

npm install spirit-link @apollo/client

This should work in the browser as well as in a NodeJS backend, although currently the browser remains untested.

Usage

import {EventlinkClient} from 'spirit-link';

// Get the email address and password for a user (probably a scorekeeper)

const eventlink = new EventlinkClient();
await eventlink.login(emailAddress, password);

// Use built-in functions to avoid GraphQL
const me = await eventlink.getMe();
console.log(`Hello ${me.firstName} ${me.lastName}!`);

// Or write your own GraphQL!
import {Query} from 'spirit-link';
const result = await eventlink.client.query<Query>({
  query: gql`query MyInfo {
          me {
              firstName
              lastName
          }
      }`
});
const meToo = result.data.me;
console.log(`Hello ${meToo.firstName} ${meToo.lastName}!`);

Queries, Mutations, and Subscriptions (via WebSocket) are all supported.

For full details on what the EventLink GraphQL API provides, check out the eventlink.gql file included in the package; note that this could very easily get out of date quickly, but it does represent the API as it existed when the library was last updated.

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.10

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.13

2 years ago

1.3.14

2 years ago

1.3.11

3 years ago

1.3.12

2 years ago

1.3.15

2 years ago

1.3.16

2 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago