diff --git a/docs/classes/Seam.md b/docs/classes/Seam.md index 15cfe185..f606c63d 100644 --- a/docs/classes/Seam.md +++ b/docs/classes/Seam.md @@ -69,7 +69,7 @@ Routes.accessCodes #### Defined in -[src/routes.ts:196](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L196) +[src/routes.ts:193](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L193) ___ @@ -89,7 +89,7 @@ Routes.actionAttempts #### Defined in -[src/routes.ts:267](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L267) +[src/routes.ts:264](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L264) ___ @@ -121,7 +121,7 @@ Routes.connectWebviews #### Defined in -[src/routes.ts:170](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L170) +[src/routes.ts:167](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L167) ___ @@ -142,7 +142,7 @@ Routes.connectedAccounts #### Defined in -[src/routes.ts:246](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L246) +[src/routes.ts:243](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L243) ___ @@ -155,7 +155,7 @@ ___ | Name | Type | | :------ | :------ | | `get` | (`params`: [`DeviceGetRequest`](../modules.md#devicegetrequest)) => `Promise`<[`Device`](../interfaces/Device.md)<[`CommonDeviceProperties`](../modules.md#commondeviceproperties), [`DeviceType`](../modules.md#devicetype)\>\> | -| `list` | (`connectedAccountId?`: `string`) => `Promise`<[`Device`](../interfaces/Device.md)<[`CommonDeviceProperties`](../modules.md#commondeviceproperties), [`DeviceType`](../modules.md#devicetype)\>[]\> | +| `list` | (`params?`: [`DevicesListRequest`](../interfaces/DevicesListRequest.md)) => `Promise`<[`Device`](../interfaces/Device.md)<[`CommonDeviceProperties`](../modules.md#commondeviceproperties), [`DeviceType`](../modules.md#devicetype)\>[]\> | | `update` | (`params`: [`DeviceUpdateRequest`](../modules.md#deviceupdaterequest)) => `Promise`<{ `ok`: ``true`` }\> | #### Inherited from @@ -164,7 +164,7 @@ Routes.devices #### Defined in -[src/routes.ts:147](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L147) +[src/routes.ts:148](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L148) ___ @@ -187,7 +187,7 @@ Routes.locks #### Defined in -[src/routes.ts:112](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L112) +[src/routes.ts:113](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L113) ___ @@ -209,7 +209,7 @@ Routes.workspaces #### Defined in -[src/routes.ts:96](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L96) +[src/routes.ts:97](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L97) ## Methods diff --git a/docs/interfaces/AccessCodeBase.md b/docs/interfaces/AccessCodeBase.md index 9fddcf72..d38d0f41 100644 --- a/docs/interfaces/AccessCodeBase.md +++ b/docs/interfaces/AccessCodeBase.md @@ -26,7 +26,7 @@ #### Defined in -[src/types/models.ts:132](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L132) +[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) ___ @@ -36,7 +36,7 @@ ___ #### Defined in -[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) +[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) ___ @@ -46,4 +46,4 @@ ___ #### Defined in -[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) +[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) diff --git a/docs/interfaces/AccessCodeCreateBaseRequest.md b/docs/interfaces/AccessCodeCreateBaseRequest.md index 0af30440..5bd42442 100644 --- a/docs/interfaces/AccessCodeCreateBaseRequest.md +++ b/docs/interfaces/AccessCodeCreateBaseRequest.md @@ -26,7 +26,7 @@ #### Defined in -[src/types/route-requests.ts:10](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L10) +[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) ___ @@ -36,7 +36,7 @@ ___ #### Defined in -[src/types/route-requests.ts:8](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L8) +[src/types/route-requests.ts:14](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L14) ___ @@ -46,4 +46,4 @@ ___ #### Defined in -[src/types/route-requests.ts:9](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L9) +[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) diff --git a/docs/interfaces/AccessCodeCreateOngoingRequest.md b/docs/interfaces/AccessCodeCreateOngoingRequest.md index e6b0fb58..71ace36b 100644 --- a/docs/interfaces/AccessCodeCreateOngoingRequest.md +++ b/docs/interfaces/AccessCodeCreateOngoingRequest.md @@ -28,7 +28,7 @@ #### Defined in -[src/types/route-requests.ts:10](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L10) +[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) ___ @@ -42,7 +42,7 @@ ___ #### Defined in -[src/types/route-requests.ts:8](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L8) +[src/types/route-requests.ts:14](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L14) ___ @@ -56,4 +56,4 @@ ___ #### Defined in -[src/types/route-requests.ts:9](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L9) +[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) diff --git a/docs/interfaces/AccessCodeCreateScheduledRequest.md b/docs/interfaces/AccessCodeCreateScheduledRequest.md index dbc77f8c..89136896 100644 --- a/docs/interfaces/AccessCodeCreateScheduledRequest.md +++ b/docs/interfaces/AccessCodeCreateScheduledRequest.md @@ -30,7 +30,7 @@ #### Defined in -[src/types/route-requests.ts:10](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L10) +[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) ___ @@ -44,7 +44,7 @@ ___ #### Defined in -[src/types/route-requests.ts:8](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L8) +[src/types/route-requests.ts:14](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L14) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/types/route-requests.ts:19](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L19) +[src/types/route-requests.ts:25](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L25) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[src/types/route-requests.ts:9](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L9) +[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) ___ @@ -78,4 +78,4 @@ ___ #### Defined in -[src/types/route-requests.ts:18](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L18) +[src/types/route-requests.ts:24](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L24) diff --git a/docs/interfaces/ConnectWebview.md b/docs/interfaces/ConnectWebview.md index 5ce828cd..f26036ed 100644 --- a/docs/interfaces/ConnectWebview.md +++ b/docs/interfaces/ConnectWebview.md @@ -10,6 +10,7 @@ - [accepted\_providers](ConnectWebview.md#accepted_providers) - [any\_device\_allowed](ConnectWebview.md#any_device_allowed) - [any\_provider\_allowed](ConnectWebview.md#any_provider_allowed) +- [authorized\_at](ConnectWebview.md#authorized_at) - [connect\_webview\_id](ConnectWebview.md#connect_webview_id) - [connected\_account\_id](ConnectWebview.md#connected_account_id) - [created\_at](ConnectWebview.md#created_at) @@ -62,6 +63,16 @@ ___ ___ +### authorized\_at + +• `Optional` **authorized\_at**: ``null`` \| `string` + +#### Defined in + +[src/types/models.ts:129](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L129) + +___ + ### connect\_webview\_id • **connect\_webview\_id**: `string` diff --git a/docs/interfaces/ConnectedAccount.md b/docs/interfaces/ConnectedAccount.md index fbe4bd14..325742bb 100644 --- a/docs/interfaces/ConnectedAccount.md +++ b/docs/interfaces/ConnectedAccount.md @@ -19,7 +19,7 @@ #### Defined in -[src/types/models.ts:157](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L157) +[src/types/models.ts:158](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L158) ___ @@ -29,7 +29,7 @@ ___ #### Defined in -[src/types/models.ts:154](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L154) +[src/types/models.ts:155](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L155) ___ @@ -39,7 +39,7 @@ ___ #### Defined in -[src/types/models.ts:155](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L155) +[src/types/models.ts:156](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L156) ___ @@ -49,4 +49,4 @@ ___ #### Defined in -[src/types/models.ts:156](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L156) +[src/types/models.ts:157](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L157) diff --git a/docs/interfaces/DevicesListRequest.md b/docs/interfaces/DevicesListRequest.md new file mode 100644 index 00000000..133154c4 --- /dev/null +++ b/docs/interfaces/DevicesListRequest.md @@ -0,0 +1,41 @@ +[seamapi](../README.md) / [Exports](../modules.md) / DevicesListRequest + +# Interface: DevicesListRequest + +## Table of contents + +### Properties + +- [connect\_webview\_id](DevicesListRequest.md#connect_webview_id) +- [connected\_account\_id](DevicesListRequest.md#connected_account_id) +- [device\_type](DevicesListRequest.md#device_type) + +## Properties + +### connect\_webview\_id + +• `Optional` **connect\_webview\_id**: `string` + +#### Defined in + +[src/types/route-requests.ts:9](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L9) + +___ + +### connected\_account\_id + +• `Optional` **connected\_account\_id**: `string` + +#### Defined in + +[src/types/route-requests.ts:8](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L8) + +___ + +### device\_type + +• `Optional` **device\_type**: `string` + +#### Defined in + +[src/types/route-requests.ts:10](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L10) diff --git a/docs/interfaces/OngoingAccessCode.md b/docs/interfaces/OngoingAccessCode.md index d6d73d40..2f693908 100644 --- a/docs/interfaces/OngoingAccessCode.md +++ b/docs/interfaces/OngoingAccessCode.md @@ -31,7 +31,7 @@ #### Defined in -[src/types/models.ts:132](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L132) +[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) +[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) ___ @@ -55,7 +55,7 @@ ___ #### Defined in -[src/types/models.ts:139](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L139) +[src/types/models.ts:140](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L140) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) +[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) ___ @@ -79,7 +79,7 @@ ___ #### Defined in -[src/types/models.ts:140](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L140) +[src/types/models.ts:141](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L141) ___ @@ -89,4 +89,4 @@ ___ #### Defined in -[src/types/models.ts:138](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L138) +[src/types/models.ts:139](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L139) diff --git a/docs/interfaces/TimeBoundAccessCode.md b/docs/interfaces/TimeBoundAccessCode.md index c3db6655..f617b900 100644 --- a/docs/interfaces/TimeBoundAccessCode.md +++ b/docs/interfaces/TimeBoundAccessCode.md @@ -33,7 +33,7 @@ #### Defined in -[src/types/models.ts:132](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L132) +[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) ___ @@ -47,7 +47,7 @@ ___ #### Defined in -[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) +[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) ___ @@ -57,7 +57,7 @@ ___ #### Defined in -[src/types/models.ts:145](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L145) +[src/types/models.ts:146](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L146) ___ @@ -67,7 +67,7 @@ ___ #### Defined in -[src/types/models.ts:148](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L148) +[src/types/models.ts:149](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L149) ___ @@ -81,7 +81,7 @@ ___ #### Defined in -[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) +[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) ___ @@ -91,7 +91,7 @@ ___ #### Defined in -[src/types/models.ts:147](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L147) +[src/types/models.ts:148](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L148) ___ @@ -101,7 +101,7 @@ ___ #### Defined in -[src/types/models.ts:146](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L146) +[src/types/models.ts:147](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L147) ___ @@ -111,4 +111,4 @@ ___ #### Defined in -[src/types/models.ts:144](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L144) +[src/types/models.ts:145](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L145) diff --git a/docs/modules.md b/docs/modules.md index 2caed19c..36ac9981 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -42,6 +42,7 @@ - [ConnectedAccountsListResponse](interfaces/ConnectedAccountsListResponse.md) - [Device](interfaces/Device.md) - [DeviceGetResponse](interfaces/DeviceGetResponse.md) +- [DevicesListRequest](interfaces/DevicesListRequest.md) - [DevicesListResponse](interfaces/DevicesListResponse.md) - [ErroredAPIResponse](interfaces/ErroredAPIResponse.md) - [LockGetResponse](interfaces/LockGetResponse.md) @@ -111,7 +112,7 @@ ___ #### Defined in -[src/types/models.ts:151](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L151) +[src/types/models.ts:152](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L152) ___ @@ -121,7 +122,7 @@ ___ #### Defined in -[src/types/route-requests.ts:22](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L22) +[src/types/route-requests.ts:28](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L28) ___ @@ -138,7 +139,7 @@ ___ #### Defined in -[src/types/route-requests.ts:26](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L26) +[src/types/route-requests.ts:32](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L32) ___ @@ -201,7 +202,7 @@ ___ #### Defined in -[src/types/route-requests.ts:31](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L31) +[src/types/route-requests.ts:37](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L37) ___ @@ -230,7 +231,7 @@ ___ #### Defined in -[src/types/route-requests.ts:39](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L39) +[src/types/route-requests.ts:45](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L45) ___ diff --git a/src/cli/commands/devices.ts b/src/cli/commands/devices.ts index cfc06070..36daebe4 100644 --- a/src/cli/commands/devices.ts +++ b/src/cli/commands/devices.ts @@ -48,7 +48,11 @@ const command: CommandModule = { }) }, async (argv) => { - await executeCommand("devices.list", [argv.connectedAccountId], argv) + await executeCommand( + "devices.list", + [{ connected_account_id: argv.connectedAccountId }], + argv + ) } ) }, diff --git a/src/routes.ts b/src/routes.ts index 9a982192..140f663a 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -17,6 +17,7 @@ import { ConnectWebviewCreateRequest, DeviceUpdateRequest, DeviceGetRequest, + DevicesListRequest, } from "./types/route-requests" import { SeamActionAttemptError } from "./lib/api-error" import { @@ -145,14 +146,10 @@ export abstract class Routes { } public readonly devices = { - list: (connectedAccountId?: string) => + list: (params?: DevicesListRequest) => this.makeRequestAndFormat("devices", { url: "/devices/list", - params: connectedAccountId - ? { - connected_account_id: connectedAccountId, - } - : {}, + params, }), get: (params: DeviceGetRequest) => this.makeRequestAndFormat("device", { diff --git a/src/types/models.ts b/src/types/models.ts index 08ccfd4c..820efa95 100644 --- a/src/types/models.ts +++ b/src/types/models.ts @@ -126,6 +126,7 @@ export interface ConnectWebview { connected_account_id?: null | string custom_redirect_url?: null | string url: string + authorized_at?: null | string } export interface AccessCodeBase { diff --git a/src/types/route-requests.ts b/src/types/route-requests.ts index bd4649db..ac3a5b58 100644 --- a/src/types/route-requests.ts +++ b/src/types/route-requests.ts @@ -4,6 +4,12 @@ export interface ConnectWebviewCreateRequest { accepted_providers: Provider[] } +export interface DevicesListRequest { + connected_account_id?: string + connect_webview_id?: string + device_type?: string +} + export interface AccessCodeCreateBaseRequest { device_id: string name?: string diff --git a/tests/routes.test.ts b/tests/routes.test.ts index 224450b5..9ca59ebc 100644 --- a/tests/routes.test.ts +++ b/tests/routes.test.ts @@ -45,7 +45,9 @@ test( "with connected account ID", testAPIMethod("devices.list"), { - args: (seed) => [seed.devices.schlageLock.connectedAccountId], + args: (seed) => [ + { connected_account_id: seed.devices.schlageLock.connectedAccountId }, + ], }, "AnyDevice[]" )