From 563b5fa046eb4a95f4d5e5aa37dd2b55a45bc1dc Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Thu, 28 Mar 2024 19:49:11 -0700 Subject: [PATCH] Add usage examples to README --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 114bdb11..436118d0 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,29 @@ $ npm install -D @seamapi/types@latest ## Usage +### Examples + +_These examples assume `SEAM_API_KEY` is set in your environment._ + +#### List devices + ```ts import { SeamHttp } from '@seamapi/http/connect' -const seam = new SeamHttp('your-api-key') +const seam = new SeamHttp() const devices = await seam.devices.list() ``` +#### Unlock a door + +```ts +import { SeamHttp } from '@seamapi/http/connect' + +const seam = new SeamHttp() +const lock = await seam.locks.get({ name: 'Front Door' }) +await seam.locks.unlockDoor({ device_id: lock.device_id }) +``` + ### Authentication Methods The SDK supports several authentication mechanisms.