npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iotery-server-sdk

v0.1.25

Published

node.js iotery.io server SDK

Downloads

7

Readme

iotery.io Server SDK

The node.js iotery.io server SDK is intended to be used on your server in order to interact with the itoery.io IoT Platform. The SDK is a fully featured wrapper for the REST API.

Getting Started

Setup your free account on iotery.io and go to your dashboard to get your server API Key.

After you get your key, install the SDK:

npm install iotery-server-sdk

And finally, some simple example usage:

const iotery = require("iotery-server-sdk")("YOUR_IOTERY_API_KEY_HERE");

async function main() {
  let thermalSensorDeviceType = await iotery.createDeviceType(null, {
    enum: "THERMAL_SENSOR",
    name: "Thermal Sensor Type"
  });

  let device = await iotery.createDevice(null, {
    name: "My Device",
    deviceTypeUuid: thermalSensorDeviceType.uuid
  });

  let devices = await iotery.getDevices(null, {
    limit: 10
  });
}

The above code connects you to the iotary.io platform, creates a device type, and a device, then retrieves all your devices.

Next, you might want to create a data type for the the device type you created...here's an example snippet:

let temperatureDataType = await iotery.createDataType(
  { deviceTypeUuid: thermalSensorDeviceType.uuid },
  {
    name: "Temperature",
    enum: "TEMPERATURE",
    units: "C",
    isNumber: true
  }
);

For a tutorial on setting up a full stack system in 15 minutes using iotery.io, check this link out.

API

This SDK simply wraps the REST API, so more information and specifics can be found there. Since the API is a wrapper around the REST API, the syntax is standard for each of the Create, Read, Update, and Delete operations on iotery.io resources. All methods return a Promise.

Creating Resources

The generalized syntax for creating resources in iotery.io looks like:

methodName({ input: "parameters" }, { data: "variables" });

For example, to create a device, the javascript would look like

createDevice(
  { deviceTypeUuid: "a-valid-device-type-uuid" },
  { name: "My Device", other: "parameter" }
);

where createDevice maps to methodName, deviceTypeUuid maps to input, and name and other map to data : "variables" in the generalized form given above.

The available resource creation methods are

| methodName | input | link | description |:-----------:|:-----------:|:-----------:|:-----------:| | createAccountManager | | link | Create an account manager. | | createConsumer | | link | Create a consumer. | | linkConsumerToDevice | consumerUuid | link | Link a consumer to a device. | | linkConsumerToNetwork | consumerUuid | link | Link a consumer to a network. | | createConsumerSecret | consumerUuid | link | Create a consumer secret for authentication. | | createDeviceType | | link | Create a device type. | | createSettingType | | link | Create a setting type. | | createDefaultSetting | | link | Create a default setting. | | createDataType | | link | Create a data type. | | createDevice | | link | Create a device. | | createBatchedCommandInstances | | link | Create a set of batched command instances. | | clearUnexecutedDeviceCommandInstances | deviceUuid | link | Clear all unexecuted command instance for a device. | | createDeviceCommandInstance | deviceUuid | link | Create a command instance for a device. | | createDeviceNotificationInstance | deviceUuid | link | Create a notification instance for a device. | | createSetting | deviceUuid | link | Create a setting for a device. | | createFirmwareRecord | | link | Create a firmware record. | | createSeverityType | | link | Create a severity type. | | createNotificationType | | link | Create a notification type. | | createNotificationField | | link | Create a notification field. | | createPriorityType | | link | Create a priority type. | | createCommandType | | link | Create a command type. | | createCommandField | | link | Create a command field. | | createEventType | | link | Create an event type. | | createEvent | | link | Create an event. | | createGroupingType | | link | Create a grouping type. | | createTeam | | link | Create a team. | | resetTeam | teamUuid | link | Reset a team by uuid. | | linkAccountManagerToTeam | teamUuid | link | Link an account manager to a team. | | createGroupingBatchedCommands | groupingUuid | link | Create a set of batched commands for a grouping and all child grouping devices. | | moveDeviceToGrouping | groupingUuid | link | Move a device to a grouping. | | createNetwork | | link | Create a network. | | createNetworkBatchedCommands | networkUuid | link | Create a set of batched commands for a network's devices. | | createGrouping | networkUuid | link | Create a network grouping. | | addChildGrouping | networkUuid,groupingUuid | link | Add a child grouping. | | createNetworkLocation | networkUuid | link | Create a network location. | | createSchedule | networkUuid | link | Create a schedule. | | executeNetworkSchedule | networkUuid,scheduleUuid | link | Execute a schedule. | | deprovisionNetwork | networkUuid | link | Deprovision a network. | | provisionNetwork | | link | Provision a network. | | provisionDevice | networkUuid,deviceUuid | link | Provision a device. | | deprovisionDevice | networkUuid,deviceUuid | link | Deprovision a device. | | executeSchedule | scheduleUuid | link | Execute a schedule. | | createGroupingDevice | | link | Create a GroupingDevice link. | | createGroupingLink | | link | Create a GroupingLink. | | createWebhookAction | | link | Create a webhook action. | | createQrCode | | link | Create a QR code. | | createIoteryTemplate | | link | Create an iotery template. | | applyIoteryTemplate | ioteryTemplateUuid | link | Apply an iotery template by uuid. |

Reading Resources

The generalized syntax for reading resources looks like:

methodName({ input: "parameters" }, { query: "variables" });

For example, to get a device, the javascript would look like

getDeviceByUuid({ deviceUuid: "a-valid-device-uuid" }, { limit: 1 });

where getDeviceByUuid maps to methodName, deviceUuid maps to input, and limit maps to query in the generalized form given above.

The available resource reading methods are

| methodName | input | link | description |:-----------:|:-----------:|:-----------:|:-----------:| | getHealthCheckResult | | link | Get the result of a server health check. | | getAccountManager | userUuid | link | Get an account manager by uuid. | | getConsumerList | | link | Get a list of available consumers. | | getConsumer | consumerUuid | link | Get a consumer by uuid. | | getConsumerDeviceList | consumerUuid | link | Get a list of devices linked to a consumer. | | getConsumerNetworkList | consumerUuid | link | Get a list of networks linked to a consumer. | | getDeviceTypeList | | link | Get a list of available device types. | | getDeviceType | deviceTypeUuid | link | Get a device type by uuid. | | getSettingTypeList | | link | Get a list of available setting types. | | getSettingType | settingTypeUuid | link | Get a setting type by uuid. | | getDefaultSettingList | | link | Get a list of default settings. | | getDefaultSetting | defaultSettingUuid | link | Get a default setting by uuid. | | getDataTypeList | | link | Get a list of available data types. | | getDataType | dataTypeUuid | link | Get a data type by uuid. | | getCommandInstanceList | | link | Get a list of command instances. | | getCommandInstance | commandInstanceUuid | link | Get a command instance by uuid. | | getDeviceList | | link | Get a list of devices. | | getDevice | deviceUuid | link | Get a device by uuid. | | getDeviceDataList | deviceUuid | link | Get a list of data for a device. | | getDeviceEventList | deviceUuid | link | Get a list of events for a device. | | getDeviceIsppConfiguration | deviceUuid | link | Get an ISPP configuration for a device. | | getDeviceNotificationInstanceList | deviceUuid | link | Get a list of notification instances for a device. | | getDeviceSettingList | deviceUuid | link | Get a list of settings for a device. | | getDeviceSystemEventList | deviceUuid | link | Get a list of system events for a device. | | getNotificationInstance | notificationInstanceUuid | link | Get a notification instance by uuid. | | getSetting | settingUuid | link | Get a setting by uuid. | | getFirmwareRecordList | | link | Get a list of firmware records. | | getFirmwareRecord | firmwareUuid | link | Get a firmware record by uuid. | | getSeverityTypeList | | link | Get a list of available severity types. | | getSeverityType | severityTypeUuid | link | Delete a severity type by uuid. | | getNotificationTypeList | | link | Get a list of available notification types. | | getNotificationType | notificationTypeUuid | link | Get a notification type by uuid. | | getNotificationFieldList | | link | Get a list of available notification fields. | | getNotificationField | notificationFieldUuid | link | Get a notification field by uuid. | | getPriorityTypeList | | link | Get a list of available priority types. | | getPriorityType | priorityTypeUuid | link | Get a priority type by uuid. | | getCommandTypeList | | link | Get a list of available command types. | | getCommandType | commandTypeUuid | link | Get a command type by uuid. | | getCommandFieldList | | link | Get a list of available command fields. | | getCommandField | commandFieldUuid | link | Get a command field by uuid. | | getEventTypeList | | link | Get a list of available event types. | | getEventType | eventTypeUuid | link | Get an event type by uuid. | | getEventList | | link | Get a list of events. | | getEvent | eventUuid | link | Get an event by uuid. | | getGroupingTypeList | | link | Get a list of available grouping types. | | getGroupingType | groupingTypeUuid | link | Get a grouping type by uuid. | | getTeamList | | link | Get a list of available teams. | | getTeam | teamUuid | link | Get a team by uuid. | | getUserListForTeam | teamUuid | link | Get a list of users for a team. | | getGrouping | groupingUuid | link | Get a grouping by uuid. | | getChildGroupingList | groupingUuid | link | Get a list of child groupings for a grouping. | | getDeviceListForGrouping | groupingUuid | link | Get a list of devices for a grouping. | | getNetworkList | | link | Get a list of networks. | | getNetwork | networkUuid | link | Get a network by uuid. | | getNetworkDeviceList | networkUuid | link | Get a network's devices. | | getNetworkGroupingList | networkUuid | link | Get a network's groupings. | | getNetworkGrouping | networkUuid,groupingUuid | link | Get a network's grouping by uuid. | | getNetworkLocationList | networkUuid | link | Get a network's locations. | | getNetworkLocation | networkUuid,networkLocationUuid | link | Get a network location by uuid. | | getNetworkScheduleList | networkUuid | link | Get a list of a network's schedules. | | getNetworkSchedule | networkUuid,scheduleUuid | link | Get a schedule by uuid. | | getSchedule | scheduleUuid | link | Get a schedule by uuid. | | getGroupingDeviceList | | link | Get a list of GroupingDevice links. | | getGroupingDevice | groupingDeviceUuid | link | Get a GroupingDevice link by uuid. | | getGroupingLinkList | | link | Get a list of GroupingLinks. | | getGroupingLink | groupingLinkUuid | link | Get a GroupingLink by uuid. | | getWebhookActionList | | link | Get a list of webhook actions. | | getWebhookAction | webhookActionUuid | link | Get a webhook action by uuid. | | getWebhookActionTypeList | | link | Get a list of webhook action types. | | getWebhookActionType | webhookActionTypeUuid | link | Get a webhook action type by uuid. | | getQrCodeList | | link | Get a list of QR codes. | | getQrCode | qrCodeUuid | link | Get a QR code by uuid. | | getIoteryTemplateList | | link | Get a list of iotery templates. | | getIoteryTemplate | ioteryTemplateUuid | link | Get an iotery template by uuid. |

Updating Resources

The generalized syntax for updating resources in iotery.io looks like:

methodName({ input: "parameters" }, { data: "variables to update" });

For example, to create a device, the javascript would look like

updateDevice(
  { deviceUuid: "a-valid-device-uuid" },
  { name: "My New Device Name", other: "new value" }
);

where updateDevice maps to methodName, deviceUuid maps to input, and name and other map to data : "variables to update" in the generalized form given above.

The available update methods are

| methodName | input | link | description |:-----------:|:-----------:|:-----------:|:-----------:| | updateAccountManager | userUuid | link | Update an account manager by uuid. | | updateConsumer | consumerUuid | link | Update a consumer by uuid. | | updateDeviceType | deviceTypeUuid | link | Update a device type by uuid. | | updateSettingType | settingTypeUuid | link | Update a setting type by uuid. | | updateDefaultSetting | defaultSettingUuid | link | Update a default setting by uuid. | | updateDataType | dataTypeUuid | link | Update a data type by uuid. | | updateCommandInstance | commandInstanceUuid | link | Update a command instance by uuid. | | updateDevice | deviceUuid | link | Update a device by uuid. | | updateNotificationInstance | notificationInstanceUuid | link | Update a notification instance. | | updateSetting | settingUuid | link | Update a setting. | | updateFirmwareRecord | firmwareUuid | link | Update a firmware record by uuid. | | updateSeverityType | severityTypeUuid | link | Update a severity type by uuid. | | updateNotificationType | notificationTypeUuid | link | Update a notification type by uuid. | | updateNotificationField | notificationFieldUuid | link | Update a notification field by uuid. | | updatePriorityType | priorityTypeUuid | link | Update a priority type by uuid. | | updateCommandType | commandTypeUuid | link | Update a command type by uuid. | | updateCommandField | commandFieldUuid | link | Update a command field by uuid. | | updateEventType | eventTypeUuid | link | Update an event type by uuid. | | updateEvent | eventUuid | link | Update an event by uuid. | | updateGroupingType | groupingTypeUuid | link | Update a grouping type by uuid. | | updateTeam | teamUuid | link | Update a team by uuid. | | updateGrouping | groupingUuid | link | Update a grouping. | | updateNetworkLocation | networkLocationUuid | link | Update a network location by uuid. | | updateNetwork | networkUuid | link | Update a network by uuid. | | updateNetworkGrouping | networkUuid,groupingUuid | link | Update a network grouping. | | updateNetworkNetworkLocation | networkUuid,networkLocationUuid | link | Update a network location. | | updateNetworkSchedule | networkUuid,scheduleUuid | link | Update a schedule. | | updateSchedule | scheduleUuid | link | Update a schedule. | | updateGroupingDevice | groupingDeviceUuid | link | Update a GroupingDevice link by uuid. | | updateGroupingLink | groupingLinkUuid | link | Update a GroupingLink by uuid. | | updateWebhookAction | webhookActionUuid | link | Update a webhook action by uuid. | | updateQrCode | qrCodeUuid | link | Update a QR code by uuid. |

Deleting Resources

The generalized syntax for deleting resources looks like:

methodName({ input: "parameters" });

For example, to delete a device, the javascript would look like

deleteDevice({ deviceUuid: "a-valid-device-uuid" });

where deleteDevice maps to methodName and deviceUuid maps to input in the generalized form given above.

The available resource deleting methods are

| methodName | input | link | description |:-----------:|:-----------:|:-----------:|:-----------:| | deleteAccountManager | userUuid | link | Delete an account manager by uuid. | | deleteConsumer | consumerUuid | link | Delete a consumer by uuid. | | unlinkConsumerFromDevice | consumerUuid,deviceUuid | link | Unlink a consumer from a device. | | unlinkConsumerFromNetwork | consumerUuid,networkUuid | link | Unlink a consumer from a network. | | deleteConsumerSecretList | consumerUuid | link | Delete all stored consumer secrets. | | deleteDeviceType | deviceTypeUuid | link | Delete a device type by uuid. | | deleteSettingType | settingTypeUuid | link | Delete a setting type by uuid. | | deleteDefaultSetting | defaultSettingUuid | link | Delete a default setting by uuid. | | deleteDataType | dataTypeUuid | link | Delete a data type by uuid. | | deleteDevice | deviceUuid | link | Delete a device by uuid. | | deleteNotificationInstance | notificationInstanceUuid | link | Delete a notification instance by uuid. | | deleteSetting | settingUuid | link | Delete a setting by uuid. | | deleteFirmwareRecord | firmwareUuid | link | Delete a firmware record by uuid. | | deleteSeverityType | severityTypeUuid | link | Delete a severity type by uuid. | | deleteNotificationType | notificationTypeUuid | link | Delete a notification type by uuid. | | deleteNotificationField | notificationFieldUuid | link | Delete a notification field by uuid. | | deletePriorityType | priorityTypeUuid | link | Delete a priority type by uuid. | | deleteCommandType | commandTypeUuid | link | Delete a command type by uuid. | | deleteCommandField | commandFieldUuid | link | Delete a command field by uuid. | | deleteEventType | eventTypeUuid | link | Delete an event type by uuid. | | deleteEvent | eventUuid | link | Delete an event by uuid. | | deleteGroupingType | groupingTypeUuid | link | Delete a grouping type by uuid. | | deleteTeam | teamUuid | link | Delete a team by uuid. | | unlinkAccountManagerFromTeam | teamUuid,userUuid | link | Unlink account manager from a team. | | deleteGrouping | groupingUuid | link | Delete a grouping by uuid. | | deleteNetwork | networkUuid | link | Delete a network by uuid. | | deleteNetworkGrouping | networkUuid,groupingUuid | link | Delete a network's grouping by uuid. | | removeDeviceFromGrouping | networkUuid,groupingUuid,deviceUuid | link | remove a device from a grouping | | deleteNetworkLocation | networkUuid,networkLocationUuid | link | Delete a network location by uuid. | | deleteNetworkSchedule | networkUuid,scheduleUuid | link | Delete a schedule by uuid. | | deleteSchedule | scheduleUuid | link | Delete a schedule by uuid. | | deleteGroupingDevice | groupingDeviceUuid | link | Delete a GroupingDevice link by uuid. | | deleteGroupingLink | groupingLinkUuid | link | Delete a GroupingLink by uuid. | | deleteWebhookAction | webhookActionUuid | link | Delete a webhook action type by uuid. | | deleteQrCode | qrCodeUuid | link | Delete a QR code by uuid. | | deleteIoteryTemplate | ioteryTemplateUuid | link | Delete an iotery template by uuid. |

Contributing

We welcome contributors and PRs! Let us know if you are interested.

Testing

To test, start the mock-server.js in /test and use mocha to run test/index.js.