Typescript client for the GEWISDB API
This repository contains the client for the GEWISDB API. It is built using TypeScript and Axios, and utilizes the Swagger API specification for generating code.
Install the dependencies:
- Switch to the right version of node (usually
nvm install --lts
,nvm use --lts
)
Use 20.16.0 and up - Install the required version of Java:
sudo apt install openjdk-19-jre-headless
To install and use this client, follow these steps:
- Clone the repository:
git clone https://github.com/GEWIS/gewisdb-ts-client.git
- Install dependencies:
npm install
To build the client, run npm run genbuild
This will first generate the TypeScript code under ./src and then generate the necessary files in the dist/
directory.
import {Configuration, MembersApi} from "gewisdb-ts-client";
const apiKey = 'API_KEY'
const basePath = 'https://database.test.gewis.nl/api'
const configuration = new Configuration({basePath, accessToken: () => apiKey});
const membersApi = new MembersApi(configuration);
membersApi.membersGet().then((res) => {
console.log(res.data);
}).catch((err) => {
console.error(err);
});
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue on the issue tracker.