Skip to content

Commit 159eadb

Browse files
authored
Merge pull request #32 from seamapi/doc-mutli-workspace
docs: Document SeamHttpMultiWorkspace
2 parents f1fe76a + 6cc9803 commit 159eadb

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,58 @@ try {
261261

262262
[action attempt]: https://docs.seam.co/latest/core-concepts/action-attempts
263263

264+
### Interacting with Multiple Workspaces
265+
266+
Some Seam API endpoints interact with multiple workspaces.
267+
The `SeamHttpMultiWorkspace` client is not bound to a specific workspace
268+
and may use those endpoints with an appropriate authentication method.
269+
270+
#### Personal Access Token
271+
272+
A Personal Access Token is scoped to a Seam Console user.
273+
Obtain one from the Seam Console.
274+
275+
```ts
276+
// Pass as an option the constructor
277+
const seam = new SeamHttpMultiWorkspace({
278+
personalAccessToken: 'your-personal-access-token',
279+
})
280+
281+
// Use the factory method
282+
const seam = SeamHttpMultiWorkspace.fromPersonalAccessToken(
283+
'some-console-session-token',
284+
)
285+
286+
// List workspaces authorized for this Personal Access Token
287+
const workspaces = await seam.workspaces.list()
288+
```
289+
290+
#### Console Session Token
291+
292+
A Console Session Token is used by the Seam Console.
293+
This authentication method is only used by internal Seam applications.
294+
295+
```ts
296+
// Pass as an option the constructor
297+
const seam = new SeamHttpMultiWorkspace({
298+
consoleSessionToken: 'some-console-session-token',
299+
})
300+
301+
// Use the factory method
302+
const seam = SeamHttpMultiWorkspace.fromConsoleSessionToken(
303+
'some-console-session-token',
304+
)
305+
306+
// List workspaces authorized for this Seam Console user
307+
const workspaces = await seam.workspaces.list()
308+
```
309+
264310
### Advanced Usage
265311

312+
#### Additional Options
313+
266314
In addition the various authentication options,
267-
the constructor takes some additional options that affect behavior.
315+
the constructor takes some advanced options that affect behavior.
268316

269317
```ts
270318
const seam = new SeamHttp({

0 commit comments

Comments
 (0)