Comparing version 1.1.2 to 1.2.0
@@ -88,6 +88,15 @@ import { AxiosRequestConfig } from 'axios'; | ||
} | ||
interface AccessCodeCreateRequest { | ||
declare type AccessCodeCreateOngoingRequest = { | ||
device_id: string; | ||
name: string; | ||
code: string; | ||
} | ||
code?: string; | ||
}; | ||
declare type AccessCodeCreateScheduledRequest = { | ||
device_id: string; | ||
name: string; | ||
code?: string; | ||
starts_at: string | Date; | ||
ends_at: string | Date; | ||
}; | ||
declare type AccessCodeCreateRequest = AccessCodeCreateOngoingRequest | AccessCodeCreateScheduledRequest; | ||
@@ -165,3 +174,3 @@ interface WorkspacesListResponse { | ||
list: (deviceId: string) => Promise<SuccessfulAPIResponse<AccessCodesListResponse>>; | ||
create: (deviceId: string, params: AccessCodeCreateRequest) => Promise<SuccessfulAPIResponse<ActionAttempt>>; | ||
create: (params: AccessCodeCreateRequest) => Promise<SuccessfulAPIResponse<ActionAttempt>>; | ||
}; | ||
@@ -192,2 +201,2 @@ readonly connectedAccounts: { | ||
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 }; | ||
export { APIErrorResponse, APIResponse, AccessCode, AccessCodeCreateOngoingRequest, AccessCodeCreateRequest, AccessCodeCreateResponse, AccessCodeCreateScheduledRequest, 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 }; |
@@ -5,18 +5,4 @@ var __create = Object.create; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
@@ -149,9 +135,16 @@ var __export = (target, all) => { | ||
}), | ||
create: (deviceId, params) => this.makeRequest({ | ||
url: "/access_codes/create", | ||
method: "POST", | ||
data: __spreadValues({ | ||
device_id: deviceId | ||
}, params) | ||
}) | ||
create: async (params) => { | ||
const parsedParams = Object.assign({}, params); | ||
if (typeof params.starts_at === "object") { | ||
parsedParams.starts_at = params.starts_at.toISOString(); | ||
} | ||
if (typeof params.ends_at === "object") { | ||
parsedParams.ends_at = params.ends_at.toISOString(); | ||
} | ||
return await this.makeRequest({ | ||
url: "/access_codes/create", | ||
method: "POST", | ||
data: parsedParams | ||
}); | ||
} | ||
}; | ||
@@ -158,0 +151,0 @@ this.connectedAccounts = { |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -13,0 +13,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
25494
387