Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RestClient

The REST API client class.

This class manipulates SwitchBot devices and infrared appliances using RESTful API.

Hierarchy

  • RestClient

Index

Constructors

constructor

  • Create a new REST API client instance.

    Parameters

    • accessToken: string

      Access token issued by Wonderlabs.

    Returns RestClient

Methods

executeScene

  • executeScene(sceneId: string): Promise<Record<string, never>>
  • Execute a manual scene.

    throws

    Will throw an error if the request does not successfully recieve a response.

    Parameters

    • sceneId: string

    Returns Promise<Record<string, never>>

    Response of the scene exceution (an empty object at the moment).

getDeviceList

  • Get a list of devices.

    throws

    Will throw an error if the request does not successfully recieve a list.

    Returns Promise<DeviceList>

    List of decices managed by your SwitchBot account.

getDeviceStatus

  • Get the status of a physical device.

    throws

    Will throw an error if the request does not successfully recieve a status.

    Parameters

    • deviceId: string

      ID of the device you want to get the status of.

    Returns Promise<DeviceStatus>

    Status of the specified physical device.

getSceneList

  • getSceneList(): Promise<Scene[]>
  • Get a list of scenes.

    throws

    Will throw an error if the request does not successfully recieve a list.

    Returns Promise<Scene[]>

    List of scenes managed by your SwitchBot account.

sendControlCommand

  • sendControlCommand(deviceId: string, data: DeviceCommand): Promise<Record<string, never>>
  • Send a command to manipulate a physical or infrared device.

    throws

    Will throw an error if the request does not successfully recieve a response.

    Parameters

    • deviceId: string

      ID of the device to be controlled.

    • data: DeviceCommand

      Command to send.

    Returns Promise<Record<string, never>>

    Response of the command exceution (an empty object at the moment).

Generated using TypeDoc