Comparing version 1.1.0 to 1.1.1
@@ -25,3 +25,3 @@ import { AxiosRequestConfig } from 'axios'; | ||
declare type DeviceType = LockDeviceType | NoiseDetectionDeviceType; | ||
declare type Provider = "august" | "schlage" | "yale" | "noiseaware"; | ||
declare type Provider = "august" | "schlage" | "yale" | "noiseaware" | "smartthings"; | ||
interface Device<Properties, Type = DeviceType> { | ||
@@ -61,3 +61,3 @@ device_id: string; | ||
accepted_providers: Provider[]; | ||
accepted_devices: never[]; | ||
accepted_devices: unknown[]; | ||
any_provider_allowed: boolean; | ||
@@ -69,2 +69,3 @@ any_device_allowed: null | boolean; | ||
connected_account_id: null | string; | ||
url: string; | ||
} | ||
@@ -76,4 +77,9 @@ interface AccessCode { | ||
created_at: string; | ||
access_code_id: string; | ||
} | ||
interface ConnectedAccount { | ||
connected_account_id: string; | ||
created_at: string; | ||
user_identifier: string; | ||
account_type: Provider; | ||
} | ||
@@ -92,5 +98,7 @@ interface ConnectWebviewCreateRequest { | ||
interface WorkspaceGetResponse { | ||
workspace: Workspace; | ||
workspace: Workspace & { | ||
connect_partner_name: string; | ||
}; | ||
} | ||
interface ResetSandboxResponse { | ||
interface WorkspaceResetSandboxResponse { | ||
message: string; | ||
@@ -112,3 +120,3 @@ } | ||
} | ||
interface ConnectWebviewListResponse { | ||
interface ConnectWebviewsListResponse { | ||
connect_webviews: ConnectWebview[]; | ||
@@ -120,3 +128,5 @@ } | ||
interface ConnectWebviewCreateResponse { | ||
connect_webview: ConnectWebview; | ||
connect_webview: Omit<ConnectWebview, "connected_account_id"> & { | ||
custom_redirect_url: null | string; | ||
}; | ||
} | ||
@@ -127,2 +137,8 @@ interface AccessCodesListResponse { | ||
declare type AccessCodeCreateResponse = ActionAttempt; | ||
interface ConnectedAccountsListResponse { | ||
connected_accounts: ConnectedAccount[]; | ||
} | ||
interface ConnectedAccountsGetResponse { | ||
connected_account: ConnectedAccount; | ||
} | ||
@@ -134,3 +150,3 @@ declare abstract class Routes { | ||
get: () => Promise<SuccessfulAPIResponse<WorkspaceGetResponse>>; | ||
resetSandbox: () => Promise<SuccessfulAPIResponse<ResetSandboxResponse>>; | ||
resetSandbox: () => Promise<SuccessfulAPIResponse<WorkspaceResetSandboxResponse>>; | ||
}; | ||
@@ -148,3 +164,3 @@ readonly locks: { | ||
readonly connectWebviews: { | ||
list: () => Promise<SuccessfulAPIResponse<ConnectWebviewListResponse>>; | ||
list: () => Promise<SuccessfulAPIResponse<ConnectWebviewsListResponse>>; | ||
get: (connectWebviewId: string) => Promise<SuccessfulAPIResponse<ConnectWebviewGetResponse>>; | ||
@@ -157,2 +173,6 @@ create: (params: ConnectWebviewCreateRequest) => Promise<SuccessfulAPIResponse<ConnectWebviewCreateResponse>>; | ||
}; | ||
readonly connectedAccounts: { | ||
list: () => Promise<SuccessfulAPIResponse<ConnectedAccountsListResponse>>; | ||
get: (connectedAccountId: string) => Promise<SuccessfulAPIResponse<ConnectedAccountsGetResponse>>; | ||
}; | ||
} | ||
@@ -178,2 +198,2 @@ | ||
export { APIErrorResponse, APIResponse, AccessCode, AccessCodeCreateRequest, AccessCodeCreateResponse, AccessCodesListResponse, ActionAttempt, ConnectWebview, ConnectWebviewCreateRequest, ConnectWebviewCreateResponse, ConnectWebviewGetResponse, ConnectWebviewListResponse, Device, DeviceGetResponse, DeviceType, DevicesListResponse, ErroredAPIResponse, LockDevice, LockDeviceType, LockGetResponse, LockLockDoorResponse, LockProperties, LockUnlockDoorResponse, LocksListResponse, NoiseDetectionDeviceType, Provider, ResetSandboxResponse, SeamAPIError, SeamAPIErrorMetadata, SuccessfulAPIResponse, Workspace, WorkspaceGetResponse, WorkspacesListResponse, Seam as default }; | ||
export { APIErrorResponse, APIResponse, AccessCode, AccessCodeCreateRequest, AccessCodeCreateResponse, AccessCodesListResponse, ActionAttempt, ConnectWebview, ConnectWebviewCreateRequest, ConnectWebviewCreateResponse, ConnectWebviewGetResponse, ConnectWebviewsListResponse, ConnectedAccount, ConnectedAccountsGetResponse, ConnectedAccountsListResponse, Device, DeviceGetResponse, DeviceType, DevicesListResponse, ErroredAPIResponse, LockDevice, LockDeviceType, LockGetResponse, LockLockDoorResponse, LockProperties, LockUnlockDoorResponse, LocksListResponse, NoiseDetectionDeviceType, Provider, SeamAPIError, SeamAPIErrorMetadata, SuccessfulAPIResponse, Workspace, WorkspaceGetResponse, WorkspaceResetSandboxResponse, WorkspacesListResponse, Seam as default }; |
@@ -156,2 +156,13 @@ var __create = Object.create; | ||
}; | ||
this.connectedAccounts = { | ||
list: () => this.makeRequest({ | ||
url: "/connected_accounts/list" | ||
}), | ||
get: (connectedAccountId) => this.makeRequest({ | ||
url: "/connected_accounts/get", | ||
params: { | ||
connected_account_id: connectedAccountId | ||
} | ||
}) | ||
}; | ||
} | ||
@@ -158,0 +169,0 @@ }; |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "MIT", | ||
@@ -27,6 +27,16 @@ "main": "./dist/index.js", | ||
"@types/node": "17.0.10", | ||
"ajv": "8.9.0", | ||
"ava": "4.0.1", | ||
"esbuild": "0.14.18", | ||
"esbuild-runner": "2.2.1", | ||
"husky": ">=6", | ||
"knex": "1.0.2", | ||
"lint-staged": "12.3.1", | ||
"nanoid": "3.2.0", | ||
"pgknexlove": "1.1.21", | ||
"prettier": "2.5.1", | ||
"testcontainers": "8.2.0", | ||
"ts-json-schema-generator": "0.97.0", | ||
"tsup": "5.11.11", | ||
"type-fest": "2.11.1", | ||
"typedoc": "0.22.11", | ||
@@ -45,6 +55,9 @@ "typedoc-plugin-markdown": "3.11.12", | ||
"build": "npm run build:package && npm run build:docs", | ||
"test": "prettier --check .", | ||
"format": "prettier --write ." | ||
"format": "prettier --write .", | ||
"format:check": "prettier --check .", | ||
"build:json-response-schemas": "ts-json-schema-generator --path src/types/route-responses.ts -o src/types/route-responses.generated.json", | ||
"test": "npm run build:json-response-schemas && ava", | ||
"test:watch": "npm run build:json-response-schemas && ava --watch" | ||
}, | ||
"repository": "https://github.com/hello-seam/seamapi-javascript" | ||
} |
@@ -5,4 +5,42 @@ # Javascript / Typescript Seam API Library | ||
## Usage | ||
```ts | ||
import Seam from seamapi | ||
const seam = new Seam() | ||
// Seam will automatically use the SEAM_API_KEY environment variable if you | ||
// don't provide an api_key to `new Seam()` | ||
const someLock = await seam.locks.list().devices[0] | ||
const someLockId = someLock.device_id | ||
await seam.locks.lockDoor(someLockId) | ||
const { device: someLockedLock } = await seam.locks.get(someLockId) | ||
// someLockedLock.properties.locked === true | ||
await seam.locks.unlockDoor(someLockId) | ||
await seam.accessCodes.create(someLockId, { name: "Some Access Code", code: "1234" }) | ||
const accessCodeList = await seam.accessCodes.list(someLockId) | ||
console.log(accessCodeList) | ||
/* | ||
{ | ||
access_codes: [ | ||
{ | ||
access_code_id: "some-access-code-1", | ||
name: "Some Access Code", | ||
code: "1234", | ||
type: "ongoing", | ||
created_at: "2022-02-01T12:57:40.843Z", | ||
}, | ||
], | ||
} | ||
*/ | ||
``` | ||
## In Progress | ||
This library is in progress! |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24597
381
46
23