Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ioki-mobility/transitland-gql-client
typesafe nodejs client for transit.land
https://github.com/ioki-mobility/transitland-gql-client
genql graphql hacktoberfest nodejs typescript
Last synced: about 1 month ago
JSON representation
typesafe nodejs client for transit.land
- Host: GitHub
- URL: https://github.com/ioki-mobility/transitland-gql-client
- Owner: ioki-mobility
- License: mit
- Created: 2022-06-01T08:14:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T01:16:26.000Z (9 months ago)
- Last Synced: 2024-05-02T01:53:14.957Z (9 months ago)
- Topics: genql, graphql, hacktoberfest, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 3.93 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# TransitLand Graphql Client
![transitland-logo-light](./assets/transitland-dark.png#gh-light-mode-only)
![transitland-logo-dark](./assets/transitland-light.png#gh-dark-mode-only)[![npm (scoped)](https://img.shields.io/npm/v/@ioki/transitland-gql-client)](https://www.npmjs.com/package/@ioki/transitland-gql-client)
[![size](https://img.shields.io/bundlephobia/minzip/@ioki/transitland-gql-client)](https://bundlephobia.com/package/@ioki/transitland-gql-client@latest)
[![npm (downloads)](https://img.shields.io/npm/dm/@ioki/transitland-gql-client)](https://www.npmjs.com/package/@ioki/transitland-gql-client)
[![github](https://img.shields.io/github/license/ioki-mobility/transitland-gql-client?)](./LICENSE.md)
[![test](https://github.com/ioki-mobility/transitland-gql-client/actions/workflows/test.yaml/badge.svg)](https://github.com/ioki-mobility/transitland-gql-client/actions/workflows/test.yaml)
[![release](https://github.com/ioki-mobility/transitland-gql-client/actions/workflows/release.yaml/badge.svg)](https://github.com/ioki-mobility/transitland-gql-client/actions/workflows/release.yaml)## About
Since the [Transitland](https://www.transit.land/) released its new and shiny [GraphQL API](https://www.transit.land/documentation/graphql-api/), it is possible to query the API using [GraphQL](https://graphql.org/).
The client is being built using [GenQL](https://genql.vercel.app/) and updated hourly, if there are upstream changes.
## Getting Started
First add the library and its peerDependency to your project:
* npm
```sh
npm i @ioki/transitland-gql-client@latest
```* yarn
```sh
yarn add @ioki/transitland-gql-client@latest
```### Setup
1. Get an API key with access to the gql api at [transit.land](https://www.transit.land/documentation/index#sign-up)
2. Create a client instance:```ts
import { createClient } from '@ioki/transitland-gql-client';const transitlandClient = createClient({
apiKey: "YOUR_SUPER_SECRET_API_KEY",
fetch: fetchClient // not needed for browser and node >= v18 (and >=v16 with --experimental-fetch)
});
```## Usage
GenQL provides a neat [converter](https://genql.vercel.app/converter) from GraphQL to TypeScript. So you can actually just test the queries you want to use in the [playground](https://www.transit.land/documentation/api/graphql-console).
## 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](src/mock.test.ts).
## License
Distributed under the MIT License. See `LICENSE.md` for more information.
## Contributing (complexity, asc)
1. [join us @ioki](https://ioki.com/about-ioki/jobs/) and make this one of your projects
2. create issues and pull requests, we're happy to enhance this## Contact
ioki Mobility - [@ioki_mobility](https://twitter.com/ioki_mobility)
Project Link: [https://github.com/ioki-mobility/transitland-gql-client](https://github.com/ioki-mobility/transitland-gql-client)