Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions docs/classes/Seam.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

___

Expand All @@ -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)

___

Expand Down Expand Up @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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`` }\> |
Expand All @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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

Expand Down
10 changes: 5 additions & 5 deletions docs/interfaces/EventsListRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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)

___

Expand All @@ -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)
21 changes: 19 additions & 2 deletions docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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` }
Expand Down Expand Up @@ -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)

___

Expand All @@ -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

Expand Down
14 changes: 14 additions & 0 deletions src/cli/commands/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ const command: CommandModule<GlobalOptions> = {
)
}
)
.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: () => {},
}
Expand Down
7 changes: 7 additions & 0 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
DeviceUpdateRequest,
DeviceGetRequest,
DevicesListRequest,
DeviceDeleteRequest,
AccessCodeUpdateRequest,
WebhookGetRequest,
WebhookCreateRequest,
Expand Down Expand Up @@ -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 = {
Expand Down
4 changes: 4 additions & 0 deletions src/types/route-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export type DeviceUpdateRequest = {
location?: object
}

export type DeviceDeleteRequest = {
device_id: string
}

export type WebhookGetRequest = {
webhook_id: string
}
Expand Down
9 changes: 9 additions & 0 deletions tests/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]")
Expand Down