Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RestClient

The REST API client class.

This class manipulates Sesame smart lock using RESTful API.

Hierarchy

  • RestClient

Index

Constructors

constructor

  • new RestClient(accessToken: string, deviceId?: undefined | string): RestClient
  • Create a new REST API client instance.

    Parameters

    • accessToken: string

      Access token issued by CANDY HOUSE.

    • Optional deviceId: undefined | string

      Device ID of your Sesame device. If undefined, the instance controls all the Sesame devices you own.

    Returns RestClient

Methods

controlLock

  • controlLock(command: Sesame.ControlCommand, deviceId?: undefined | string): Promise<Sesame.TaskId>
  • Control your lock.

    throws

    Will throw an error if the argument is not passed and you manage more than one locks.

    Parameters

    • command: Sesame.ControlCommand

      Command to perform.

    • Optional deviceId: undefined | string

      Device ID you want to control. If undefined and you own only one lock, ID will be automatically inferred.

    Returns Promise<Sesame.TaskId>

getLockStatus

  • getLockStatus(deviceId?: undefined | string): Promise<LockStatus>
  • Get a status of lock

    throws

    Will throw an error if the argument is not passed and you manage more than one locks.

    Parameters

    • Optional deviceId: undefined | string

      Device ID whose status you want to check. If undefined and you own only one lock, ID will be automatically inferred.

    Returns Promise<LockStatus>

getLocksList

  • getLocksList(): Promise<Lock[]>
  • Get a list of locks you own.

    Returns Promise<Lock[]>

queryExecutionResult

  • queryExecutionResult(taskId: Sesame.TaskId): Promise<Sesame.ExecutionResult>
  • Fetch a result of command execution associated with the task ID.

    Parameters

    • taskId: Sesame.TaskId

      Task ID you want to qeury.

    Returns Promise<Sesame.ExecutionResult>

Generated using TypeDoc