Skip to content

Commit 1046830

Browse files
authored
feat: Add Seam CLI (#432)
* feat: Add seam cli * Add to README
1 parent 957371a commit 1046830

8 files changed

Lines changed: 533 additions & 13 deletions

File tree

‎.github/workflows/check.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ jobs:
105105
run: npm install --save ${{ steps.packages.outputs.paths }}
106106
- name: Run
107107
run: node index.js
108+
- name: Run CLI
109+
run: npx --yes --package ${{ steps.packages.outputs.paths }} seam --version
108110
typecheck:
109111
name: Typecheck (Node.js v${{ matrix.node }})
110112
runs-on: ubuntu-latest

‎README.md‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ The SDK is fully tree-shakeable
1515
and optimized for use in both client and server applications.
1616

1717
The repository does not contain the SDK code.
18-
Instead, it re-exports from a core set of Seam modules:
18+
Instead, it builds on a core set of Seam modules:
1919

20+
- [@seamapi/cli]: Command line interface for interacting with the Seam API.
2021
- [@seamapi/http]: JavaScript HTTP client for the Seam API written in TypeScript.
2122
- [@seamapi/webhook]: Webhook SDK for the Seam API written in TypeScript.
2223

2324
[Seam]: https://www.seam.co/
2425
[Seam Docs]: https://docs.seam.co/latest/
26+
[@seamapi/cli]: https://github.com/seamapi/cli
2527
[@seamapi/http]: https://github.com/seamapi/javascript-http
2628
[@seamapi/webhook]: https://github.com/seamapi/javascript-webhook
2729

@@ -56,6 +58,7 @@ Instead, it re-exports from a core set of Seam modules:
5658
- [Overriding the Client](#overriding-the-client)
5759
- [Alternative endpoint path interface](#alternative-endpoint-path-interface)
5860
- [Inspecting the Request](#inspecting-the-request)
61+
- [Command Line Interface](#command-line-interface)
5962
- [Receiving Webhooks](#receiving-webhooks)
6063
- [Development and Testing](#development-and-testing)
6164
- [Quickstart](#quickstart)
@@ -547,6 +550,40 @@ console.log(`${request.method} ${request.url}`, JSON.stringify(request.body))
547550
const devices = await request.execute()
548551
```
549552

553+
### Command Line Interface
554+
555+
Every `seam` command is interactive and will prompt you for any missing
556+
required properties with helpful suggestions. To avoid automatic behavior,
557+
pass `-y`
558+
559+
```bash
560+
# Login to Seam
561+
seam login
562+
563+
# Select your workspace
564+
seam select workspace
565+
566+
# Interactively select commands to execute
567+
seam
568+
569+
# Create a connect webview to connect devices
570+
seam connect-webviews create
571+
572+
# List devices in your workspace
573+
seam devices list
574+
575+
MY_DOOR=$(seam devices get --name "Front Door" --id-only)
576+
577+
# Unlock a lock
578+
seam locks unlock-door --device-id $MY_DOOR
579+
580+
# Create an access code
581+
seam access-codes create --code "1234" --name "My Code"
582+
583+
# List your access codes
584+
seam access-codes list --device-id $MY_DOOR
585+
```
586+
550587
### Receiving Webhooks
551588
552589
The Seam API implements webhooks using [Svix](https://www.svix.com).

‎generate-readme.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const submodules: Submodule[] = [
1313
heading: null,
1414
readmePath: path.join('node_modules', '@seamapi', 'http', readmeName),
1515
},
16+
{
17+
heading: 'Command Line Interface',
18+
readmePath: path.join('node_modules', '@seamapi', 'cli', readmeName),
19+
},
1620
{
1721
heading: 'Receiving Webhooks',
1822
readmePath: path.join('node_modules', '@seamapi', 'webhook', readmeName),
@@ -59,6 +63,7 @@ async function writeReadmeUsage(content: string): Promise<void> {
5963
}
6064

6165
const updatedContent = content
66+
.replaceAll('@seamapi/cli', 'seam')
6267
.replaceAll('@seamapi/webhook', 'seam')
6368
.replaceAll('@seamapi/http', 'seam')
6469
.replaceAll('SeamHttp', 'Seam')

0 commit comments

Comments
 (0)