Skip to content

metabolize-forks/graphql-trello

 
 

Repository files navigation

trello-apollo

GraphQL interface to the Trello REST API

Usage

There are two ways of using this package:

  1. As a library for running GraphQL queries locally.
  2. Deploy your own Apollo-based GraphQL server e.g. to Heroku.

As a library

Install the package:

npm install @metabolize/graphql-trello
// Pass a GraphQL string or use `graphql-tag` to pass in a parsed query.
const gql = require('graphql-tag')
const queryTrello = require('../lib')

const credentials = {
  trelloKey: '...',
  trelloToken: '...',
}

const boardID = '...'

async function main() {
  const variables = { boardId }

  const { getBoard: board } = await queryTrello({
    query: gql`
      query($boardId: String!) {
        getBoard(boardId: $boardId) {
          id
          name
          lists {
            id
            name
            cards {
              id
              name
              comments {
                id
                content
              }
            }
          }
          members {
            id
            username
          }
        }
      }
    `,
    variables,
    ...credentials,
  })

  console.log(JSON.stringify(board, undefined, 2))

  return board
}

See the examples directory for more!

Deploy your own server

Fill this in.

Acknowledgements

Adapted from graphql-trello by Luke Horvat.

License

This project is licensed under the MIT License.

About

GraphQL interface to Trello's API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%