@grunt-io/api
v0.1.5
Published
TypeScript client for Grunt asset APIs
Readme
grunt-io - api
TypeScript client for Grunt asset APIs.
Installation
npm install @grunt-io/apiRequires an environment with a global fetch (Node.js 18+, modern browsers, Deno, Bun) or a custom fetch implementation passed in.
Usage
import { GruntAssetClient } from "@grunt-io/api";
import { GruntPptxGen } from "@grunt-io/pptxgen";
const client = new GruntAssetClient({
baseUrl: process.env.GRUNT_API_BASE_URL!,
token: process.env.GRUNT_API_TOKEN!
});
const exportProject = await client.exportProject({
assetId: "asset-id",
projectCommitKey: "(optional asset-commit)",
bounds: {
x: 0,
y: 0,
width: 397,
height: 397 /*(in points not inches)*/
}
});
const grunt = new GruntPptxGen(pptx);
for (const object of exportProject.objects) {
grunt.addGruntObject(slide, {
position: object.position,
svg: object.svg,
pageObject: object.pageObject,
dataService: object.dataService,
resources: object.resources,
});
}
await grunt.writeFile("example.pptx");exportProject() returns exported objects shaped to be close to grunt-io-pptxgen's addGruntObject() input, while still exposing pageObjectKey, objectType, and svgBounds metadata on each object.
License
Proprietary.
