Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Instead, it re-exports from a core set of Seam modules:
- [Iterate over all pages](#iterate-over-all-pages)
- [Iterate over all resources](#iterate-over-all-resources)
- [Return all resources across all pages as an array](#return-all-resources-across-all-pages-as-an-array)
- [Interacting with Multiple Workspaces](#interacting-with-multiple-workspaces)
- [Requests without a Workspace in scope](#requests-without-a-workspace-in-scope)
- [Personal Access Token](#personal-access-token-1)
- [Console Session Token](#console-session-token-1)
- [Advanced Usage](#advanced-usage)
Expand All @@ -58,6 +58,8 @@ Instead, it re-exports from a core set of Seam modules:
- [Configuring the Axios Client](#configuring-the-axios-client)
- [Using the Axios Client](#using-the-axios-client)
- [Overriding the Client](#overriding-the-client)
- [Alternative endpoint path interface](#alternative-endpoint-path-interface)
- [Enable undocumented API](#enable-undocumented-api)
- [Inspecting the Request](#inspecting-the-request)
- [Receiving Webhooks](#receiving-webhooks)
- [Development and Testing](#development-and-testing)
Expand Down Expand Up @@ -408,10 +410,10 @@ const pages = seam.createPaginator(
const devices = await pages.flattenToArray()
```

### Interacting with Multiple Workspaces
### Requests without a Workspace in scope

Some Seam API endpoints interact with multiple workspaces.
The `SeamMultiWorkspace` client is not bound to a specific workspace
Some Seam API endpoints do not require a workspace in scope.
The `SeamWithoutWorkspace` client is not bound to a specific workspace
and may use those endpoints with an appropriate authentication method.

#### Personal Access Token
Expand All @@ -421,15 +423,15 @@ Obtain one from the Seam Console.

```ts
// Set the `SEAM_PERSONAL_ACCESS_TOKEN` environment variable
const seam = new SeamMultiWorkspace()
const seam = new SeamWithoutWorkspace()

// Pass as an option to the constructor
const seam = new SeamMultiWorkspace({
const seam = new SeamWithoutWorkspace({
personalAccessToken: 'your-personal-access-token',
})

// Use the factory method
const seam = SeamMultiWorkspace.fromPersonalAccessToken(
const seam = SeamWithoutWorkspace.fromPersonalAccessToken(
'some-console-session-token',
)

Expand All @@ -444,12 +446,12 @@ This authentication method is only used by internal Seam applications.

```ts
// Pass as an option to the constructor
const seam = new SeamMultiWorkspace({
const seam = new SeamWithoutWorkspace({
consoleSessionToken: 'some-console-session-token',
})

// Use the factory method
const seam = SeamMultiWorkspace.fromConsoleSessionToken(
const seam = SeamWithoutWorkspace.fromConsoleSessionToken(
'some-console-session-token',
)

Expand Down Expand Up @@ -523,6 +525,31 @@ const devices = await seam.client.get<DevicesListResponse>('/devices/list')
An Axios compatible client may be provided to create a `Seam` instance.
This API is used internally and is not directly supported.

#### Alternative endpoint path interface

The `SeamEndpoints` class offers an alternative path-based interface to every API endpoint.
Each endpoint is exposed as simple property that returns the corresponding method from `Seam`.

```ts
import { SeamEndpoints } from 'seam'

const seam = new SeamEndpoints()
const devices = await seam['/devices/list']()
```

#### Enable undocumented API

Pass the `isUndocumentedApiEnabled` option to allow using the undocumented API.
This API is used internally and is not directly supported.
Do not use the undocumented API in production environments.
Seam is not responsible for any issues you may encounter with the undocumented API.

```ts
import { Seam } from 'seam'

const seam = new Seam({ isUndocumentedApiEnabled: true })
```

#### Inspecting the Request

All client methods return an instance of `SeamHttpRequest`.
Expand Down
2 changes: 1 addition & 1 deletion generate-readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ async function writeReadmeUsage(content: string): Promise<void> {
const updatedContent = content
.replaceAll('@seamapi/webhook', 'seam')
.replaceAll('@seamapi/http', 'seam')
.replaceAll('@seamapi/types', 'seam')
.replaceAll('SeamHttp', 'Seam')
.replaceAll('SeamRequest', 'SeamHttpRequest')
.replaceAll('seam/connect', 'seam')

const currentUsageSection = matches[1]

Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"npm": ">= 9.0.0"
},
"dependencies": {
"@seamapi/http": "1.35.1",
"@seamapi/types": "1.420.2",
"@seamapi/http": "1.45.0",
"@seamapi/types": "1.441.1",
"@seamapi/webhook": "1.1.1",
"zod": "^3.21.4"
},
Expand Down
19 changes: 13 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import {
SeamHttp as Seam,
SeamHttpEndpoints as SeamEndpoints,
SeamHttpMultiWorkspace as SeamMultiWorkspace,
type SeamHttpMultiWorkspaceOptions as SeamMultiWorkspaceOptions,
type SeamHttpOptions as SeamOptions,
} from '@seamapi/http/connect'
SeamHttpWithoutWorkspace as SeamWithoutWorkspace,
type SeamHttpWithoutWorkspace as SeamWithoutWorkspaceOptions,
type SeamHttpWithoutWorkspaceOptions as SeamMultiWorkspaceOptions,
} from '@seamapi/http'

export * from '@seamapi/http/connect'
export type * from '@seamapi/types/connect'
export * from '@seamapi/http'
export type * from '@seamapi/types'
export * from '@seamapi/webhook'
export { Seam, SeamMultiWorkspace }
export type { SeamMultiWorkspaceOptions, SeamOptions }
export { Seam, SeamEndpoints, SeamMultiWorkspace, SeamWithoutWorkspace }
export type {
SeamMultiWorkspaceOptions,
SeamOptions,
SeamWithoutWorkspaceOptions,
}