Skip to content

aaronvanston/up-graph

Repository files navigation

up-graph

up-graph 😎

Unofficial GraphQL layer for Up bank API

Built using:

Supported functionality

  • Accounts - list, get
  • Ping - get
  • Tags - list, add to transaction, remove from transaction
  • Transactions - list, get, list by account
  • Webhooks - list, get, create, delete, ping, list logs

View the GitHub project for this repo to track real time progress of functionality.

Running Locally

Starting the dev server

  1. Install dependencies
yarn install
  1. Start the server
yarn start

The local dev server will now start on http://localhost:3000

Playground

Access and use the GraphQL playground after starting your server at http://localhost:3000/graphql

To test and verify successful connection you can query the version of the GraphQL server:

Query:

query {
  version
}

Response:

{
  "data": {
    "version": "local"
  }
}

Authorisation

To access the UP API An Authorization HTTP header is required. This GraphQL servers forwards across any supplied Authorization to UP.

To get your very own personal access token for UP, visit their getting started page.

For all secure operations (every query/mutation other than version). You are required to ad the auth token. Inside of the Playground you can add an Authorization HTTP header under the HTTP HEADER tab, and add your unique token.

{
  "Authorization": "Bearer up:yeah:<token>"
}

Once authorised, you may run a secure operation such as the ping query to test full end-to-end.

Query:

query {
  ping {
    meta {
      id
      statusEmoji
    }
  }
}

Response:

{
  "data": {
    "ping": {
      "meta": {
        "id": "<id>",
        "statusEmoji": "⚡️"
      }
    }
  }
}

Testing and linting

Running test suite

Coming soon™

Running code linting

To run and verify tslint, you can run

yarn lint

Generating Types

The schema for this GraphQL server is automatically generated by the type definitions for the queries and mutations.

These are auto-generated using GraphQL code generator at build. You can manually trigger it by running:

yarn codegen

This will refresh the schema src/modules/schema.d.ts.

Adding a new module

To add a new module (resource) to up-graph:

  1. Create new folder within src/modules
  2. Build out the type definitions for the resource, query and mutations by creating a type-defs.ts file.
  3. Run yarn codegen to generate the schema from these types
  4. Create your resolvers if required
  5. Create a index.ts within the modules, wiring up the data source, types and resolvers
  6. Add the module to src/modules/index.ts

Releases

No releases published

Packages