-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from seamapi/base-class
- Loading branch information
Showing
20 changed files
with
1,689 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,41 @@ | ||
#!/usr/bin/env tsx | ||
|
||
import landlubber from 'landlubber' | ||
import { env } from 'node:process' | ||
|
||
import * as todo from './todo.js' | ||
import landlubber, { | ||
type DefaultContext, | ||
defaultMiddleware, | ||
type EmptyOptions, | ||
type Handler as DefaultHandler, | ||
type MiddlewareFunction, | ||
} from 'landlubber' | ||
|
||
const commands = [todo] | ||
import { SeamHttp } from '@seamapi/http/connect' | ||
|
||
await landlubber(commands).parse() | ||
import * as workspace from './workspace.js' | ||
|
||
export type Handler<Options = EmptyOptions> = DefaultHandler<Options, Context> | ||
|
||
type Context = DefaultContext & ClientContext | ||
|
||
interface ClientContext { | ||
client: SeamHttp | ||
} | ||
|
||
const commands = [workspace] | ||
|
||
const createAppContext: MiddlewareFunction = async (argv) => { | ||
const apiKey = argv['api-key'] | ||
if (typeof apiKey !== 'string') throw new Error('Missing Seam API key') | ||
const client = SeamHttp.fromApiKey(apiKey) | ||
argv['client'] = client | ||
} | ||
|
||
const middleware = [...defaultMiddleware, createAppContext] | ||
|
||
await landlubber<Context>(commands, { middleware }) | ||
.describe('api-key', 'Seam API key') | ||
.string('api-key') | ||
.default('api-key', env['SEAM_API_KEY'], 'SEAM_API_KEY') | ||
.demandOption('api-key') | ||
.parse() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Builder, Command, Describe } from 'landlubber' | ||
|
||
import type { Handler } from './index.js' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface Options {} | ||
|
||
export const command: Command = 'workspace' | ||
|
||
export const describe: Describe = 'Get workspace' | ||
|
||
export const builder: Builder = {} | ||
|
||
export const handler: Handler<Options> = async ({ client, logger }) => { | ||
const workspace = await client.workspaces.get() | ||
logger.info({ workspace }, 'workspace') | ||
} |
Oops, something went wrong.