@seamapi/http 1.0.0-rc.3 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/dist/connect.cjs +7 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +5 -0
- package/lib/seam/connect/api-error-types.d.ts +3 -0
- package/lib/seam/connect/seam-http-error.d.ts +2 -0
- package/lib/seam/connect/seam-http-error.js +18 -0
- package/lib/seam/connect/seam-http-error.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/seam/connect/api-error-types.ts +1 -0
- package/src/lib/seam/connect/seam-http-error.ts +6 -0
- package/src/lib/version.ts +1 -1
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ const seam = new SeamHttp()
|
|
|
122
122
|
// Pass as the first argument to the constructor
|
|
123
123
|
const seam = new SeamHttp('your-api-key')
|
|
124
124
|
|
|
125
|
-
// Pass as an option the constructor
|
|
125
|
+
// Pass as an option to the constructor
|
|
126
126
|
const seam = new SeamHttp({ apiKey: 'your-api-key' })
|
|
127
127
|
|
|
128
128
|
// Use the factory method
|
|
@@ -134,7 +134,7 @@ const seam = SeamHttp.fromApiKey('your-api-key')
|
|
|
134
134
|
A Client Session Token is scoped to a client session and should only be used on the client.
|
|
135
135
|
|
|
136
136
|
```ts
|
|
137
|
-
// Pass as an option the constructor
|
|
137
|
+
// Pass as an option to the constructor
|
|
138
138
|
const seam = new SeamHttp({ clientSessionToken: 'some-client-session-token' })
|
|
139
139
|
|
|
140
140
|
// Use the factory method
|
|
@@ -174,7 +174,7 @@ A workspace ID must be provided when using this method
|
|
|
174
174
|
and all requests will be scoped to that workspace.
|
|
175
175
|
|
|
176
176
|
```ts
|
|
177
|
-
// Pass as an option the constructor
|
|
177
|
+
// Pass as an option to the constructor
|
|
178
178
|
|
|
179
179
|
const seam = new SeamHttp({
|
|
180
180
|
personalAccessToken: 'your-personal-access-token',
|
|
@@ -196,7 +196,7 @@ A workspace ID must be provided when using this method
|
|
|
196
196
|
and all requests will be scoped to that workspace.
|
|
197
197
|
|
|
198
198
|
```ts
|
|
199
|
-
// Pass as an option the constructor
|
|
199
|
+
// Pass as an option to the constructor
|
|
200
200
|
const seam = new SeamHttp({
|
|
201
201
|
consoleSessionToken: 'some-console-session-token',
|
|
202
202
|
workspaceId: 'your-workspace-id',
|
|
@@ -234,7 +234,7 @@ and want to wait for it to resolve, simply use
|
|
|
234
234
|
await seam.actionAttempts.get({ action_attempt_id })
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
Or, to get the current state of an action attempt by ID without waiting
|
|
237
|
+
Or, to get the current state of an action attempt by ID without waiting:
|
|
238
238
|
|
|
239
239
|
```ts
|
|
240
240
|
await seam.actionAttempts.get(
|
|
@@ -245,7 +245,7 @@ await seam.actionAttempts.get(
|
|
|
245
245
|
)
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
To disable this behavior, set the default option for the client
|
|
248
|
+
To disable this behavior, set the default option for the client:
|
|
249
249
|
|
|
250
250
|
```ts
|
|
251
251
|
const seam = new SeamHttp({
|
|
@@ -256,7 +256,7 @@ const seam = new SeamHttp({
|
|
|
256
256
|
await seam.locks.unlockDoor({ device_id })
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
or the behavior may be configured per-request
|
|
259
|
+
or the behavior may be configured per-request:
|
|
260
260
|
|
|
261
261
|
```ts
|
|
262
262
|
await seam.locks.unlockDoor(
|
|
@@ -267,7 +267,8 @@ await seam.locks.unlockDoor(
|
|
|
267
267
|
)
|
|
268
268
|
```
|
|
269
269
|
|
|
270
|
-
The `pollingInterval` and `timeout` may be configured for the client or per-request
|
|
270
|
+
The `pollingInterval` and `timeout` may be configured for the client or per-request.
|
|
271
|
+
For example:
|
|
271
272
|
|
|
272
273
|
```ts
|
|
273
274
|
import {
|
|
@@ -319,7 +320,7 @@ A Personal Access Token is scoped to a Seam Console user.
|
|
|
319
320
|
Obtain one from the Seam Console.
|
|
320
321
|
|
|
321
322
|
```ts
|
|
322
|
-
// Pass as an option the constructor
|
|
323
|
+
// Pass as an option to the constructor
|
|
323
324
|
const seam = new SeamHttpMultiWorkspace({
|
|
324
325
|
personalAccessToken: 'your-personal-access-token',
|
|
325
326
|
})
|
|
@@ -339,7 +340,7 @@ A Console Session Token is used by the Seam Console.
|
|
|
339
340
|
This authentication method is only used by internal Seam applications.
|
|
340
341
|
|
|
341
342
|
```ts
|
|
342
|
-
// Pass as an option the constructor
|
|
343
|
+
// Pass as an option to the constructor
|
|
343
344
|
const seam = new SeamHttpMultiWorkspace({
|
|
344
345
|
consoleSessionToken: 'some-console-session-token',
|
|
345
346
|
})
|
package/dist/connect.cjs
CHANGED
|
@@ -476,13 +476,20 @@ var SeamHttpUnauthorizedError = class extends SeamHttpApiError {
|
|
|
476
476
|
var isSeamHttpUnauthorizedError = (error) => {
|
|
477
477
|
return error instanceof SeamHttpUnauthorizedError;
|
|
478
478
|
};
|
|
479
|
+
var _validationErrors;
|
|
479
480
|
var SeamHttpInvalidInputError = class extends SeamHttpApiError {
|
|
480
481
|
constructor(error, statusCode, requestId) {
|
|
481
482
|
super(error, statusCode, requestId);
|
|
483
|
+
__privateAdd(this, _validationErrors);
|
|
482
484
|
this.name = this.constructor.name;
|
|
483
485
|
this.code = "invalid_input";
|
|
486
|
+
__privateSet(this, _validationErrors, error.validation_errors ?? {});
|
|
487
|
+
}
|
|
488
|
+
getValidationErrorMessages(paramName) {
|
|
489
|
+
return __privateGet(this, _validationErrors)[paramName]?._errors ?? [];
|
|
484
490
|
}
|
|
485
491
|
};
|
|
492
|
+
_validationErrors = new WeakMap();
|
|
486
493
|
var isSeamHttpInvalidInputError = (error) => {
|
|
487
494
|
return error instanceof SeamHttpInvalidInputError;
|
|
488
495
|
};
|