Generate API client code

Install dependency

npm install -D @writeflow/types

Generate API client code

npx @writeflow/client@latest --key <API-Key> --outDir ./src/utils
/src
	/utils
		- writeflow.ts

Usage

const api = writeflow({ apiKey: "YOUR-API-KEY" });

const contents = await api.content.list({
	fields: {
		id: true,
		title: true,
		slug: true
	}
});

const contentById = await api.content.byId("some-id", {
	fields: {
		id: true,
		title: true,
		properties: true,
		body: true
	}
});

const contentBySlug = await api.content.bySlug("some-slug", {
	fields: {
		id: true,
		title: true,
		properties: true,
		md: true
	}
});