Skip to content

petrbroz/forge-deno-sdk

Repository files navigation

forge-deno-sdk

.github/workflows/deno.yml

Experimental Autodesk Forge SDK for Deno (v1.7.0).

Available on https://deno.land:

Prerequisites

Usage

  • Import any classes you need from the mod.ts file of a specific version of this module, for example:
// app.ts

import { AuthenticationClient } from "https://deno.land/x/forge@v0.1.0/mod.ts";

const FORGE_CLIENT_ID = Deno.env.get("FORGE_CLIENT_ID");
const FORGE_CLIENT_SECRET = Deno.env.get("FORGE_CLIENT_SECRET");
if (!FORGE_CLIENT_ID || !FORGE_CLIENT_SECRET) {
  console.error("Missing environment variables");
  Deno.exit(1);
}

async function run() {
  const client = new AuthenticationClient(FORGE_CLIENT_ID, FORGE_CLIENT_SECRET);
  const token = await client.authenticate(["data:read"], false);
  console.log(token);
}

run();
  • Set the following environment variables:
    • FORGE_CLIENT_ID - your Forge application's client ID
    • FORGE_CLIENT_SECRET - your Forge application's client secret
  • Run your app from the terminal, for example:
deno app.ts

Test

  • Set the following environment variables:
    • FORGE_CLIENT_ID - your Forge application's client ID
    • FORGE_CLIENT_SECRET - your Forge application's client secret
  • Run the following command in the terminal:
deno test

Format code

deno fmt **/*.ts

Resources