@dj1tjoo/eetlijst-api
v0.0.20
Published
A simple TypeScript API for Eetlijst.
Readme
@dj1tjoo/eetlijst-api
A simple TypeScript API for Eetlijst.
[!NOTE] This project is made for use in a student house, and will probably not be maintend
Usage
Install:
pnpm install @dj1tjoo/eetlijst-apiThe API url will default to https://api.eetlijst.nl/v1/graphql. The API can be retrieved from the account page, under Developer API key (BETA), at https://v5.eetlijst.nl/account
import { eetlijst } from '@dj1tjoo/eetlijst-api';
const client = eetlijst({
url: "<API_URL>",
apiKey: "<API_KEY>",
});
client.events.attendance
.get({ eventId: "<EVENT_ID>", userId: "<USER_ID>" })
.then((result) => {
console.log(JSON.stringify(result, null, 2));
});
client.expenses
.create({
groupId: "<GROUP_ID>",
description: "Test expense",
payedBy: "<USER_ID>",
payedAt: dayjs().toISOString(),
payedAmount: 500,
data: [
{ count: 1, user_id: "<USER_ID>", payed_amount: -250 },
{ count: 1, user_id: "<USER_ID>", payed_amount: 250 },
],
})
.then((result) => {
console.log(JSON.stringify(result, null, 2));
});
See Examples for more
Scripts
pnpm run build– Build the package with Vite (output indist/)pnpm run codegen– Run GraphQL code generationpnpm run watch– Watch GraphQL codegen
Publishing
- Build the package:
pnpm run build - Publish:
npm publish --access public
GraphQL Codegen with Vite
This project uses vite-plugin-graphql-codegen for seamless integration.
See vite.config.ts and src/codegen/codegen.ts for configuration details.
