diff --git a/docs/classes/Seam.md b/docs/classes/Seam.md index 619070a0..d5e5ab92 100644 --- a/docs/classes/Seam.md +++ b/docs/classes/Seam.md @@ -72,7 +72,7 @@ Routes.accessCodes #### Defined in -[src/routes.ts:212](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L212) +[src/routes.ts:219](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L219) ___ @@ -92,7 +92,7 @@ Routes.actionAttempts #### Defined in -[src/routes.ts:276](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L276) +[src/routes.ts:283](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L283) ___ @@ -124,7 +124,7 @@ Routes.connectWebviews #### Defined in -[src/routes.ts:186](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L186) +[src/routes.ts:193](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L193) ___ @@ -145,7 +145,7 @@ Routes.connectedAccounts #### Defined in -[src/routes.ts:255](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L255) +[src/routes.ts:262](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L262) ___ @@ -157,6 +157,7 @@ ___ | Name | Type | | :------ | :------ | +| `delete` | (`params`: [`DeviceDeleteRequest`](../modules.md#devicedeleterequest)) => `Promise`<{ `ok`: ``true`` }\> | | `get` | (`params`: [`DeviceGetRequest`](../modules.md#devicegetrequest)) => `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`` }\> | @@ -167,7 +168,7 @@ Routes.devices #### Defined in -[src/routes.ts:155](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L155) +[src/routes.ts:156](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L156) ___ @@ -187,7 +188,7 @@ Routes.events #### Defined in -[src/routes.ts:174](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L174) +[src/routes.ts:181](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L181) ___ @@ -210,7 +211,7 @@ Routes.locks #### Defined in -[src/routes.ts:120](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L120) +[src/routes.ts:121](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L121) ___ @@ -233,7 +234,7 @@ Routes.webhooks #### Defined in -[src/routes.ts:286](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L286) +[src/routes.ts:293](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L293) ___ @@ -255,7 +256,7 @@ Routes.workspaces #### Defined in -[src/routes.ts:104](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L104) +[src/routes.ts:105](https://github.com/seamapi/javascript/blob/main/src/routes.ts#L105) ## Methods diff --git a/docs/interfaces/EventsListRequest.md b/docs/interfaces/EventsListRequest.md index 42ba9e9c..2ddbf86b 100644 --- a/docs/interfaces/EventsListRequest.md +++ b/docs/interfaces/EventsListRequest.md @@ -20,7 +20,7 @@ #### Defined in -[src/types/route-requests.ts:83](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L83) +[src/types/route-requests.ts:87](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L87) ___ @@ -30,7 +30,7 @@ ___ #### Defined in -[src/types/route-requests.ts:82](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L82) +[src/types/route-requests.ts:86](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L86) ___ @@ -40,7 +40,7 @@ ___ #### Defined in -[src/types/route-requests.ts:85](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L85) +[src/types/route-requests.ts:89](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L89) ___ @@ -50,7 +50,7 @@ ___ #### Defined in -[src/types/route-requests.ts:84](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L84) +[src/types/route-requests.ts:88](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L88) ___ @@ -60,4 +60,4 @@ ___ #### Defined in -[src/types/route-requests.ts:81](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L81) +[src/types/route-requests.ts:85](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L85) diff --git a/docs/modules.md b/docs/modules.md index cfe651f8..63e71e5d 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -78,6 +78,7 @@ - [ActionType](modules.md#actiontype) - [AnyDevice](modules.md#anydevice) - [CommonDeviceProperties](modules.md#commondeviceproperties) +- [DeviceDeleteRequest](modules.md#devicedeleterequest) - [DeviceGetRequest](modules.md#devicegetrequest) - [DeviceType](modules.md#devicetype) - [DeviceUpdateRequest](modules.md#deviceupdaterequest) @@ -238,6 +239,22 @@ ___ ___ +### DeviceDeleteRequest + +Ƭ **DeviceDeleteRequest**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `device_id` | `string` | + +#### Defined in + +[src/types/route-requests.ts:72](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L72) + +___ + ### DeviceGetRequest Ƭ **DeviceGetRequest**: { `device_id`: `string` } \| { `name`: `string` } @@ -355,7 +372,7 @@ ___ #### Defined in -[src/types/route-requests.ts:76](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L76) +[src/types/route-requests.ts:80](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L80) ___ @@ -371,7 +388,7 @@ ___ #### Defined in -[src/types/route-requests.ts:72](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L72) +[src/types/route-requests.ts:76](https://github.com/seamapi/javascript/blob/main/src/types/route-requests.ts#L76) ## Functions diff --git a/src/cli/commands/devices.ts b/src/cli/commands/devices.ts index 36daebe4..bf1c98fc 100644 --- a/src/cli/commands/devices.ts +++ b/src/cli/commands/devices.ts @@ -55,6 +55,20 @@ const command: CommandModule = { ) } ) + .command( + "delete", + "delete a device", + (yargs) => { + return yargs.option("id", { + describe: "the device ID", + type: "string", + demandOption: true, + }) + }, + async (argv) => { + await executeCommand("devices.delete", [{ device_id: argv.id }], argv) + } + ) }, handler: () => {}, } diff --git a/src/routes.ts b/src/routes.ts index a9c81f5b..44d21631 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -18,6 +18,7 @@ import { DeviceUpdateRequest, DeviceGetRequest, DevicesListRequest, + DeviceDeleteRequest, AccessCodeUpdateRequest, WebhookGetRequest, WebhookCreateRequest, @@ -169,6 +170,12 @@ export abstract class Routes { method: "PATCH", data: params, }), + delete: (params: DeviceDeleteRequest) => + this.makeRequest({ + url: "/devices/delete", + method: "DELETE", + params: params, + }), } public readonly events = { diff --git a/src/types/route-requests.ts b/src/types/route-requests.ts index d8073328..c2be44cc 100644 --- a/src/types/route-requests.ts +++ b/src/types/route-requests.ts @@ -69,6 +69,10 @@ export type DeviceUpdateRequest = { location?: object } +export type DeviceDeleteRequest = { + device_id: string +} + export type WebhookGetRequest = { webhook_id: string } diff --git a/tests/routes.test.ts b/tests/routes.test.ts index aca80468..0e9fd3ff 100644 --- a/tests/routes.test.ts +++ b/tests/routes.test.ts @@ -67,6 +67,15 @@ test( }, "AnyDevice" ) +test( + "delete", + testAPIMethod("devices.delete"), + { + args: (seed) => [{ device_id: seed.devices.schlageLock.id1 }], + modifiesState: true, + }, + "{}" +) // Connect Webviews test(testAPIMethod("connectWebviews.list"), {}, "ConnectWebview[]")