Goal Import Handy API v2 using a code generator and use the imported code to create a TypeScript application that starts Handy and then stops it after 5 seconds
Completion time 15min
Skills needed Typescript, package managers
Installed tools nodejs + npm

https://youtu.be/rmLhOFsRYOA

Intro

All our APIs can be generated into full-typed classes. In this tutorial, we will generate code from the Handy API v2 and make a Handy move using the generated code.

Initialize the project

Create a folder and navigate into the folder:

mkdir typescript-api
cd typescript-api

Create a file called ts-demo.ts

Create a new project.

npm init -y

Install the needed packages

Typescript and ts-node

Not needed if you already have this installed globally

npm install -D typescript ts-node

openapi-typescript-codegen code generator

The code generator will generate typed codes for all the API functions.

npm install -D openapi-typescript-codegen 

Axios