diff --git a/docs/classes/Seam.md b/docs/classes/Seam.md index f606c63d..09005158 100644 --- a/docs/classes/Seam.md +++ b/docs/classes/Seam.md @@ -62,6 +62,7 @@ Routes.constructor | `create` | (`params`: [`AccessCodeCreateOngoingRequest`](../interfaces/AccessCodeCreateOngoingRequest.md)) => `Promise`<[`OngoingAccessCode`](../interfaces/OngoingAccessCode.md)\>(`params`: [`AccessCodeCreateScheduledRequest`](../interfaces/AccessCodeCreateScheduledRequest.md)) => `Promise`<[`TimeBoundAccessCode`](../interfaces/TimeBoundAccessCode.md)\> | | `delete` | (`params`: [`AccessCodeDeleteRequest`](../modules.md#accesscodedeleterequest)) => `Promise`<`unknown`\> | | `list` | (`params`: { `device_id`: `string` }) => `Promise`<[`AccessCode`](../modules.md#accesscode)[]\> | +| `update` | (`params`: [`AccessCodeUpdateRequest`](../modules.md#accesscodeupdaterequest)) => `Promise`<[`OngoingAccessCode`](../interfaces/OngoingAccessCode.md) \| [`TimeBoundAccessCode`](../interfaces/TimeBoundAccessCode.md)\> | #### Inherited from @@ -69,7 +70,7 @@ Routes.accessCodes #### Defined in -[src/routes.ts:193](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L193) +[src/routes.ts:196](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L196) ___ @@ -89,7 +90,7 @@ Routes.actionAttempts #### Defined in -[src/routes.ts:264](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L264) +[src/routes.ts:260](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L260) ___ @@ -121,7 +122,7 @@ Routes.connectWebviews #### Defined in -[src/routes.ts:167](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L167) +[src/routes.ts:170](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L170) ___ @@ -142,7 +143,7 @@ Routes.connectedAccounts #### Defined in -[src/routes.ts:243](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L243) +[src/routes.ts:239](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L239) ___ @@ -164,7 +165,7 @@ Routes.devices #### Defined in -[src/routes.ts:148](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L148) +[src/routes.ts:151](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L151) ___ @@ -187,7 +188,7 @@ Routes.locks #### Defined in -[src/routes.ts:113](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L113) +[src/routes.ts:116](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L116) ___ @@ -209,7 +210,7 @@ Routes.workspaces #### Defined in -[src/routes.ts:97](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L97) +[src/routes.ts:100](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L100) ## Methods diff --git a/docs/interfaces/AccessCodeBase.md b/docs/interfaces/AccessCodeBase.md index d38d0f41..4b592520 100644 --- a/docs/interfaces/AccessCodeBase.md +++ b/docs/interfaces/AccessCodeBase.md @@ -26,7 +26,7 @@ #### Defined in -[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) +[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) ___ @@ -36,7 +36,7 @@ ___ #### Defined in -[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) +[src/types/models.ts:137](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L137) ___ @@ -46,4 +46,4 @@ ___ #### Defined in -[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) +[src/types/models.ts:136](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L136) diff --git a/docs/interfaces/AccessCodeCreateBaseRequest.md b/docs/interfaces/AccessCodeCreateBaseRequest.md index 5bd42442..cc11af74 100644 --- a/docs/interfaces/AccessCodeCreateBaseRequest.md +++ b/docs/interfaces/AccessCodeCreateBaseRequest.md @@ -26,7 +26,7 @@ #### Defined in -[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) +[src/types/route-requests.ts:17](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L17) ___ @@ -36,7 +36,7 @@ ___ #### Defined in -[src/types/route-requests.ts:14](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L14) +[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) ___ @@ -46,4 +46,4 @@ ___ #### Defined in -[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) +[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) diff --git a/docs/interfaces/AccessCodeCreateOngoingRequest.md b/docs/interfaces/AccessCodeCreateOngoingRequest.md index 71ace36b..1db71783 100644 --- a/docs/interfaces/AccessCodeCreateOngoingRequest.md +++ b/docs/interfaces/AccessCodeCreateOngoingRequest.md @@ -28,7 +28,7 @@ #### Defined in -[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) +[src/types/route-requests.ts:17](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L17) ___ @@ -42,7 +42,7 @@ ___ #### Defined in -[src/types/route-requests.ts:14](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L14) +[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) ___ @@ -56,4 +56,4 @@ ___ #### Defined in -[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) +[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) diff --git a/docs/interfaces/AccessCodeCreateScheduledRequest.md b/docs/interfaces/AccessCodeCreateScheduledRequest.md index 89136896..bb828687 100644 --- a/docs/interfaces/AccessCodeCreateScheduledRequest.md +++ b/docs/interfaces/AccessCodeCreateScheduledRequest.md @@ -30,7 +30,7 @@ #### Defined in -[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) +[src/types/route-requests.ts:17](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L17) ___ @@ -44,7 +44,7 @@ ___ #### Defined in -[src/types/route-requests.ts:14](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L14) +[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/types/route-requests.ts:25](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L25) +[src/types/route-requests.ts:26](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L26) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[src/types/route-requests.ts:15](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L15) +[src/types/route-requests.ts:16](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L16) ___ @@ -78,4 +78,4 @@ ___ #### Defined in -[src/types/route-requests.ts:24](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L24) +[src/types/route-requests.ts:25](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L25) diff --git a/docs/interfaces/AccessCodeUpdateBaseRequest.md b/docs/interfaces/AccessCodeUpdateBaseRequest.md new file mode 100644 index 00000000..c67c2a43 --- /dev/null +++ b/docs/interfaces/AccessCodeUpdateBaseRequest.md @@ -0,0 +1,30 @@ +[seamapi](../README.md) / [Exports](../modules.md) / AccessCodeUpdateBaseRequest + +# Interface: AccessCodeUpdateBaseRequest + +## Table of contents + +### Properties + +- [access\_code\_id](AccessCodeUpdateBaseRequest.md#access_code_id) +- [device\_id](AccessCodeUpdateBaseRequest.md#device_id) + +## Properties + +### access\_code\_id + +• **access\_code\_id**: `string` + +#### Defined in + +[src/types/route-requests.ts:35](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L35) + +___ + +### device\_id + +• `Optional` **device\_id**: `string` + +#### Defined in + +[src/types/route-requests.ts:34](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L34) diff --git a/docs/interfaces/ActionAttemptResultTypeMap.md b/docs/interfaces/ActionAttemptResultTypeMap.md index 1b559747..8fa5064a 100644 --- a/docs/interfaces/ActionAttemptResultTypeMap.md +++ b/docs/interfaces/ActionAttemptResultTypeMap.md @@ -16,6 +16,7 @@ - [DELETE\_ACCESS\_CODE](ActionAttemptResultTypeMap.md#delete_access_code) - [LOCK\_DOOR](ActionAttemptResultTypeMap.md#lock_door) - [UNLOCK\_DOOR](ActionAttemptResultTypeMap.md#unlock_door) +- [UPDATE\_ACCESS\_CODE](ActionAttemptResultTypeMap.md#update_access_code) ## Properties @@ -35,7 +36,7 @@ Record.CREATE\_ACCESS\_CODE #### Defined in -[src/types/models.ts:100](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L100) +[src/types/models.ts:101](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L101) ___ @@ -66,3 +67,23 @@ ___ #### Inherited from Record.UNLOCK\_DOOR + +___ + +### UPDATE\_ACCESS\_CODE + +• **UPDATE\_ACCESS\_CODE**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `access_code` | [`AccessCode`](../modules.md#accesscode) | + +#### Overrides + +Record.UPDATE\_ACCESS\_CODE + +#### Defined in + +[src/types/models.ts:102](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L102) diff --git a/docs/interfaces/ActionAttemptWithError.md b/docs/interfaces/ActionAttemptWithError.md index 84804329..9747ac48 100644 --- a/docs/interfaces/ActionAttemptWithError.md +++ b/docs/interfaces/ActionAttemptWithError.md @@ -36,7 +36,7 @@ ActionAttemptBase.action\_attempt\_id #### Defined in -[src/types/models.ts:74](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L74) +[src/types/models.ts:75](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L75) ___ @@ -50,7 +50,7 @@ ActionAttemptBase.action\_type #### Defined in -[src/types/models.ts:75](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L75) +[src/types/models.ts:76](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L76) ___ @@ -71,7 +71,7 @@ ActionAttemptBase.error #### Defined in -[src/types/models.ts:92](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L92) +[src/types/models.ts:93](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L93) ___ @@ -85,7 +85,7 @@ ActionAttemptBase.result #### Defined in -[src/types/models.ts:91](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L91) +[src/types/models.ts:92](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L92) ___ @@ -99,4 +99,4 @@ ActionAttemptBase.status #### Defined in -[src/types/models.ts:90](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L90) +[src/types/models.ts:91](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L91) diff --git a/docs/interfaces/ConnectWebview.md b/docs/interfaces/ConnectWebview.md index f26036ed..4cb9b81f 100644 --- a/docs/interfaces/ConnectWebview.md +++ b/docs/interfaces/ConnectWebview.md @@ -29,7 +29,7 @@ #### Defined in -[src/types/models.ts:120](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L120) +[src/types/models.ts:122](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L122) ___ @@ -39,7 +39,7 @@ ___ #### Defined in -[src/types/models.ts:119](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L119) +[src/types/models.ts:121](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L121) ___ @@ -49,7 +49,7 @@ ___ #### Defined in -[src/types/models.ts:122](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L122) +[src/types/models.ts:124](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L124) ___ @@ -59,7 +59,7 @@ ___ #### Defined in -[src/types/models.ts:121](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L121) +[src/types/models.ts:123](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L123) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[src/types/models.ts:129](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L129) +[src/types/models.ts:131](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L131) ___ @@ -79,7 +79,7 @@ ___ #### Defined in -[src/types/models.ts:116](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L116) +[src/types/models.ts:118](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L118) ___ @@ -89,7 +89,7 @@ ___ #### Defined in -[src/types/models.ts:126](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L126) +[src/types/models.ts:128](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L128) ___ @@ -99,7 +99,7 @@ ___ #### Defined in -[src/types/models.ts:123](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L123) +[src/types/models.ts:125](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L125) ___ @@ -109,7 +109,7 @@ ___ #### Defined in -[src/types/models.ts:127](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L127) +[src/types/models.ts:129](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L129) ___ @@ -119,7 +119,7 @@ ___ #### Defined in -[src/types/models.ts:118](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L118) +[src/types/models.ts:120](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L120) ___ @@ -129,7 +129,7 @@ ___ #### Defined in -[src/types/models.ts:124](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L124) +[src/types/models.ts:126](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L126) ___ @@ -139,7 +139,7 @@ ___ #### Defined in -[src/types/models.ts:125](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L125) +[src/types/models.ts:127](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L127) ___ @@ -149,7 +149,7 @@ ___ #### Defined in -[src/types/models.ts:128](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L128) +[src/types/models.ts:130](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L130) ___ @@ -159,4 +159,4 @@ ___ #### Defined in -[src/types/models.ts:117](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L117) +[src/types/models.ts:119](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L119) diff --git a/docs/interfaces/ConnectWebviewCreateRequest.md b/docs/interfaces/ConnectWebviewCreateRequest.md index df52502d..e60418c0 100644 --- a/docs/interfaces/ConnectWebviewCreateRequest.md +++ b/docs/interfaces/ConnectWebviewCreateRequest.md @@ -16,4 +16,4 @@ #### Defined in -[src/types/route-requests.ts:4](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L4) +[src/types/route-requests.ts:5](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L5) diff --git a/docs/interfaces/ConnectedAccount.md b/docs/interfaces/ConnectedAccount.md index 325742bb..f7f66c5f 100644 --- a/docs/interfaces/ConnectedAccount.md +++ b/docs/interfaces/ConnectedAccount.md @@ -19,7 +19,7 @@ #### Defined in -[src/types/models.ts:158](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L158) +[src/types/models.ts:160](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L160) ___ @@ -29,7 +29,7 @@ ___ #### Defined in -[src/types/models.ts:155](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L155) +[src/types/models.ts:157](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L157) ___ @@ -39,7 +39,7 @@ ___ #### Defined in -[src/types/models.ts:156](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L156) +[src/types/models.ts:158](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L158) ___ @@ -49,4 +49,4 @@ ___ #### Defined in -[src/types/models.ts:157](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L157) +[src/types/models.ts:159](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L159) diff --git a/docs/interfaces/DevicesListRequest.md b/docs/interfaces/DevicesListRequest.md index 133154c4..431d0316 100644 --- a/docs/interfaces/DevicesListRequest.md +++ b/docs/interfaces/DevicesListRequest.md @@ -18,7 +18,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:10](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L10) ___ @@ -28,7 +28,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:9](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L9) ___ @@ -38,4 +38,4 @@ ___ #### 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:11](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L11) diff --git a/docs/interfaces/OngoingAccessCode.md b/docs/interfaces/OngoingAccessCode.md index 2f693908..6f22c6e4 100644 --- a/docs/interfaces/OngoingAccessCode.md +++ b/docs/interfaces/OngoingAccessCode.md @@ -31,7 +31,7 @@ #### Defined in -[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) +[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) +[src/types/models.ts:137](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L137) ___ @@ -55,7 +55,7 @@ ___ #### Defined in -[src/types/models.ts:140](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L140) +[src/types/models.ts:142](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L142) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) +[src/types/models.ts:136](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L136) ___ @@ -79,7 +79,7 @@ ___ #### Defined in -[src/types/models.ts:141](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L141) +[src/types/models.ts:143](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L143) ___ @@ -89,4 +89,4 @@ ___ #### Defined in -[src/types/models.ts:139](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L139) +[src/types/models.ts:141](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L141) diff --git a/docs/interfaces/PendingActionAttempt.md b/docs/interfaces/PendingActionAttempt.md index 1b41be0e..018db80e 100644 --- a/docs/interfaces/PendingActionAttempt.md +++ b/docs/interfaces/PendingActionAttempt.md @@ -36,7 +36,7 @@ ActionAttemptBase.action\_attempt\_id #### Defined in -[src/types/models.ts:74](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L74) +[src/types/models.ts:75](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L75) ___ @@ -50,7 +50,7 @@ ActionAttemptBase.action\_type #### Defined in -[src/types/models.ts:75](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L75) +[src/types/models.ts:76](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L76) ___ @@ -64,7 +64,7 @@ ActionAttemptBase.error #### Defined in -[src/types/models.ts:85](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L85) +[src/types/models.ts:86](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L86) ___ @@ -78,7 +78,7 @@ ActionAttemptBase.result #### Defined in -[src/types/models.ts:84](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L84) +[src/types/models.ts:85](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L85) ___ @@ -92,4 +92,4 @@ ActionAttemptBase.status #### Defined in -[src/types/models.ts:83](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L83) +[src/types/models.ts:84](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L84) diff --git a/docs/interfaces/SuccessfulActionAttempt.md b/docs/interfaces/SuccessfulActionAttempt.md index 8c469627..d23da9cf 100644 --- a/docs/interfaces/SuccessfulActionAttempt.md +++ b/docs/interfaces/SuccessfulActionAttempt.md @@ -36,7 +36,7 @@ ActionAttemptBase.action\_attempt\_id #### Defined in -[src/types/models.ts:74](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L74) +[src/types/models.ts:75](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L75) ___ @@ -50,7 +50,7 @@ ActionAttemptBase.action\_type #### Defined in -[src/types/models.ts:75](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L75) +[src/types/models.ts:76](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L76) ___ @@ -64,7 +64,7 @@ ActionAttemptBase.error #### Defined in -[src/types/models.ts:106](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L106) +[src/types/models.ts:108](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L108) ___ @@ -78,7 +78,7 @@ ActionAttemptBase.result #### Defined in -[src/types/models.ts:107](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L107) +[src/types/models.ts:109](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L109) ___ @@ -92,4 +92,4 @@ ActionAttemptBase.status #### Defined in -[src/types/models.ts:105](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L105) +[src/types/models.ts:107](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L107) diff --git a/docs/interfaces/TimeBoundAccessCode.md b/docs/interfaces/TimeBoundAccessCode.md index f617b900..b4eceff4 100644 --- a/docs/interfaces/TimeBoundAccessCode.md +++ b/docs/interfaces/TimeBoundAccessCode.md @@ -33,7 +33,7 @@ #### Defined in -[src/types/models.ts:133](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L133) +[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) ___ @@ -47,7 +47,7 @@ ___ #### Defined in -[src/types/models.ts:135](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L135) +[src/types/models.ts:137](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L137) ___ @@ -57,7 +57,7 @@ ___ #### Defined in -[src/types/models.ts:146](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L146) +[src/types/models.ts:148](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L148) ___ @@ -67,7 +67,7 @@ ___ #### Defined in -[src/types/models.ts:149](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L149) +[src/types/models.ts:151](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L151) ___ @@ -81,7 +81,7 @@ ___ #### Defined in -[src/types/models.ts:134](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L134) +[src/types/models.ts:136](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L136) ___ @@ -91,7 +91,7 @@ ___ #### Defined in -[src/types/models.ts:148](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L148) +[src/types/models.ts:150](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L150) ___ @@ -101,7 +101,7 @@ ___ #### Defined in -[src/types/models.ts:147](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L147) +[src/types/models.ts:149](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L149) ___ @@ -111,4 +111,4 @@ ___ #### Defined in -[src/types/models.ts:145](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L145) +[src/types/models.ts:147](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L147) diff --git a/docs/modules.md b/docs/modules.md index 36ac9981..0ca0366f 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -27,6 +27,7 @@ - [AccessCodeCreateBaseRequest](interfaces/AccessCodeCreateBaseRequest.md) - [AccessCodeCreateOngoingRequest](interfaces/AccessCodeCreateOngoingRequest.md) - [AccessCodeCreateScheduledRequest](interfaces/AccessCodeCreateScheduledRequest.md) +- [AccessCodeUpdateBaseRequest](interfaces/AccessCodeUpdateBaseRequest.md) - [AccessCodesListResponse](interfaces/AccessCodesListResponse.md) - [ActionAttemptCreateResponse](interfaces/ActionAttemptCreateResponse.md) - [ActionAttemptGetResponse](interfaces/ActionAttemptGetResponse.md) @@ -65,6 +66,9 @@ - [AccessCode](modules.md#accesscode) - [AccessCodeCreateRequest](modules.md#accesscodecreaterequest) - [AccessCodeDeleteRequest](modules.md#accesscodedeleterequest) +- [AccessCodeUpdateOngoingRequest](modules.md#accesscodeupdateongoingrequest) +- [AccessCodeUpdateRequest](modules.md#accesscodeupdaterequest) +- [AccessCodeUpdateScheduledRequest](modules.md#accesscodeupdatescheduledrequest) - [ActionAttempt](modules.md#actionattempt) - [ActionType](modules.md#actiontype) - [AnyDevice](modules.md#anydevice) @@ -112,7 +116,7 @@ ___ #### Defined in -[src/types/models.ts:152](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L152) +[src/types/models.ts:154](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L154) ___ @@ -122,7 +126,7 @@ ___ #### Defined in -[src/types/route-requests.ts:28](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L28) +[src/types/route-requests.ts:29](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L29) ___ @@ -139,7 +143,37 @@ ___ #### Defined in -[src/types/route-requests.ts:32](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L32) +[src/types/route-requests.ts:52](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L52) + +___ + +### AccessCodeUpdateOngoingRequest + +Ƭ **AccessCodeUpdateOngoingRequest**: `Except`<[`AccessCodeCreateOngoingRequest`](interfaces/AccessCodeCreateOngoingRequest.md), ``"device_id"``\> & [`AccessCodeUpdateBaseRequest`](interfaces/AccessCodeUpdateBaseRequest.md) + +#### Defined in + +[src/types/route-requests.ts:38](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L38) + +___ + +### AccessCodeUpdateRequest + +Ƭ **AccessCodeUpdateRequest**: [`AccessCodeUpdateOngoingRequest`](modules.md#accesscodeupdateongoingrequest) \| [`AccessCodeUpdateScheduledRequest`](modules.md#accesscodeupdatescheduledrequest) + +#### Defined in + +[src/types/route-requests.ts:48](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L48) + +___ + +### AccessCodeUpdateScheduledRequest + +Ƭ **AccessCodeUpdateScheduledRequest**: `Except`<[`AccessCodeCreateScheduledRequest`](interfaces/AccessCodeCreateScheduledRequest.md), ``"device_id"``\> & [`AccessCodeUpdateBaseRequest`](interfaces/AccessCodeUpdateBaseRequest.md) + +#### Defined in + +[src/types/route-requests.ts:43](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L43) ___ @@ -155,13 +189,13 @@ ___ #### Defined in -[src/types/models.ts:110](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L110) +[src/types/models.ts:112](https://github.com/seamapi/javascript/blob/main/src/types/models.ts#L112) ___ ### ActionType -Ƭ **ActionType**: ``"LOCK_DOOR"`` \| ``"UNLOCK_DOOR"`` \| ``"CREATE_ACCESS_CODE"`` \| ``"DELETE_ACCESS_CODE"`` +Ƭ **ActionType**: ``"LOCK_DOOR"`` \| ``"UNLOCK_DOOR"`` \| ``"CREATE_ACCESS_CODE"`` \| ``"UPDATE_ACCESS_CODE"`` \| ``"DELETE_ACCESS_CODE"`` #### Defined in @@ -202,7 +236,7 @@ ___ #### Defined in -[src/types/route-requests.ts:37](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L37) +[src/types/route-requests.ts:57](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L57) ___ @@ -231,7 +265,7 @@ ___ #### Defined in -[src/types/route-requests.ts:45](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L45) +[src/types/route-requests.ts:65](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L65) ___ diff --git a/src/routes.ts b/src/routes.ts index 140f663a..bb5c4d8d 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -18,6 +18,9 @@ import { DeviceUpdateRequest, DeviceGetRequest, DevicesListRequest, + AccessCodeUpdateScheduledRequest, + AccessCodeUpdateOngoingRequest, + AccessCodeUpdateRequest, } from "./types/route-requests" import { SeamActionAttemptError } from "./lib/api-error" import { @@ -198,32 +201,11 @@ export abstract class Routes { }), create: (async (params: AccessCodeCreateRequest) => { - const parsedParams: any = Object.assign({}, params) - - if ( - (params as AccessCodeCreateScheduledRequest).starts_at === "object" && - (params as AccessCodeCreateScheduledRequest).starts_at !== null - ) { - parsedParams.starts_at = ( - (params as AccessCodeCreateScheduledRequest).starts_at as Date - ).toISOString() - } - - if ( - typeof (params as AccessCodeCreateScheduledRequest).ends_at === - "object" && - (params as AccessCodeCreateScheduledRequest).starts_at !== null - ) { - parsedParams.ends_at = ( - (params as AccessCodeCreateScheduledRequest).ends_at as Date - ).toISOString() - } - const action = await this.createActionAttemptAndWait<"CREATE_ACCESS_CODE">({ url: "/access_codes/create", method: "POST", - data: parsedParams, + data: params, }) return action.access_code @@ -232,6 +214,20 @@ export abstract class Routes { (params: AccessCodeCreateScheduledRequest): Promise }, + // We can't narrow the return type here like we do with create because we're given partial input + update: async ( + params: AccessCodeUpdateRequest + ): Promise => { + const action = + await this.createActionAttemptAndWait<"UPDATE_ACCESS_CODE">({ + url: "/access_codes/update", + method: "POST", + data: params, + }) + + return action.access_code + }, + delete: (params: AccessCodeDeleteRequest) => this.createActionAttemptAndWait({ url: "/access_codes/delete", diff --git a/src/types/models.ts b/src/types/models.ts index 820efa95..6a3400e4 100644 --- a/src/types/models.ts +++ b/src/types/models.ts @@ -68,6 +68,7 @@ export type ActionType = | "LOCK_DOOR" | "UNLOCK_DOOR" | "CREATE_ACCESS_CODE" + | "UPDATE_ACCESS_CODE" | "DELETE_ACCESS_CODE" interface ActionAttemptBase { @@ -98,6 +99,7 @@ export interface ActionAttemptWithError export interface ActionAttemptResultTypeMap extends Record { CREATE_ACCESS_CODE: { access_code: AccessCode } + UPDATE_ACCESS_CODE: { access_code: AccessCode } } export interface SuccessfulActionAttempt diff --git a/src/types/route-requests.ts b/src/types/route-requests.ts index ac3a5b58..1f502ba1 100644 --- a/src/types/route-requests.ts +++ b/src/types/route-requests.ts @@ -1,3 +1,4 @@ +import { Except } from "type-fest" import { CommonDeviceProperties, Provider } from "./models" export interface ConnectWebviewCreateRequest { @@ -29,6 +30,25 @@ export type AccessCodeCreateRequest = | AccessCodeCreateOngoingRequest | AccessCodeCreateScheduledRequest +export interface AccessCodeUpdateBaseRequest { + device_id?: string + access_code_id: string +} + +export type AccessCodeUpdateOngoingRequest = Except< + AccessCodeCreateOngoingRequest, + "device_id" +> & + AccessCodeUpdateBaseRequest +export type AccessCodeUpdateScheduledRequest = Except< + AccessCodeCreateScheduledRequest, + "device_id" +> & + AccessCodeUpdateBaseRequest +export type AccessCodeUpdateRequest = + | AccessCodeUpdateOngoingRequest + | AccessCodeUpdateScheduledRequest + export type AccessCodeDeleteRequest = { device_id?: string access_code_id: string diff --git a/tests/fixtures/plugins/get-server-plugin.ts b/tests/fixtures/plugins/get-server-plugin.ts index 629b87b1..0fc2a1fa 100644 --- a/tests/fixtures/plugins/get-server-plugin.ts +++ b/tests/fixtures/plugins/get-server-plugin.ts @@ -3,12 +3,13 @@ import { URL } from "url" import defaultAxios from "axios" import knex from "knex" import path from "path" -import Seam from "../../../src" +import Seam, { AccessCode } from "../../../src" type SeedLock = { connectedAccountId: string id1: string name1: string + accessCode: AccessCode } export type WorkerPublishedMessage = { diff --git a/tests/fixtures/workers/helpers/add-fake-august-devices.ts b/tests/fixtures/workers/helpers/add-fake-august-devices.ts index f9407e4f..7c22aba1 100644 --- a/tests/fixtures/workers/helpers/add-fake-august-devices.ts +++ b/tests/fixtures/workers/helpers/add-fake-august-devices.ts @@ -12,7 +12,13 @@ const addFakeAugustDevices = async (axios: Axios) => { const [firstDevice] = await getDeviceType(axios, "august_lock") - await axios.post("/access_codes/create", { + const { + data: { + action_attempt: { + result: { access_code }, + }, + }, + } = await axios.post("/access_codes/create", { device_id: firstDevice.device_id, name: "Sample Code", code: "1234", @@ -23,6 +29,7 @@ const addFakeAugustDevices = async (axios: Axios) => { id1: firstDevice.device_id, name1: firstDevice.properties.name, connectedAccountId: firstDevice.third_party_account_id, + accessCode: access_code, } } diff --git a/tests/fixtures/workers/helpers/add-fake-schlage-devices.ts b/tests/fixtures/workers/helpers/add-fake-schlage-devices.ts index acdde753..554bf502 100644 --- a/tests/fixtures/workers/helpers/add-fake-schlage-devices.ts +++ b/tests/fixtures/workers/helpers/add-fake-schlage-devices.ts @@ -12,7 +12,13 @@ const addFakeSchlageDevices = async (axios: Axios) => { const [firstDevice] = await getDeviceType(axios, "schlage_lock") - await axios.post("/access_codes/create", { + const { + data: { + action_attempt: { + result: { access_code }, + }, + }, + } = await axios.post("/access_codes/create", { device_id: firstDevice.device_id, name: "Sample Code", code: "1234", @@ -23,6 +29,7 @@ const addFakeSchlageDevices = async (axios: Axios) => { id1: firstDevice.device_id, name1: firstDevice.properties.name, connectedAccountId: firstDevice.third_party_account_id, + accessCode: access_code, } } diff --git a/tests/routes.test.ts b/tests/routes.test.ts index 9ca59ebc..aca80468 100644 --- a/tests/routes.test.ts +++ b/tests/routes.test.ts @@ -130,3 +130,17 @@ test( }, "AccessCode" ) + +test( + testAPIMethod("accessCodes.update"), + { + args: (seed) => [ + { + access_code_id: seed.devices.augustLock.accessCode.access_code_id, + name: "new name", + }, + ], + modifiesState: true, + }, + "AccessCode" +)