TransitLand Graphql Client
About
Since the Transitland released its new and shiny GraphQL API, it is possible to query the API using GraphQL.
The client is being built using genql and updated hourly, if there are upstream changes.
Getting Started
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Prerequisites
First add the library and its peerDependency graphql
to your project:
-
npm
npm install @ioki/transitland-gql-client@latest grapqhl
-
yarn
yarn add @ioki/transitland-gql-client@latest grapqhl
Setup
- Get an API key with access to the gql api at transit.land
- Create a client instance:
import { createClient } from '@ioki/transitland-gql-client';
const transitlandClient = createClient({
apiKey: "YOUR_SUPER_SECRET_API_KEY"
});
Usage
GenQL provides a neat converter from GraphQL to TypeScript. So you can actually just test the queries you want to use in the playground.
Mocking
Using GraphQL's strict type definitions, it is pretty easy to generate a mock server you could use during your tests. An extensive example is stored as a test.
License
Distributed under the MIT License. See LICENSE.md
for more information.
Contributing (complexity, asc)
- join us @ioki and make this one of your projects
- create issues and pull requests, we're happy to enhance this
Contact
ioki Mobility - @ioki_mobility
Project Link: https://github.com/ioki-mobility/transitland-gql-client