obniz-cloud-sdk
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

obniz-cloud-sdk

About obniz GraphQL API

api.obniz.com

を利用するための SDK です。

install

npm i obniz-cloud-sdk

Usage

// Type Script
import { getSdk } from 'obniz-cloud-sdk';

async function getDevices(token: string) {
  const obnizAPI = getSdk(token);
  const result = await obnizAPI.devices();
  for (const edge of result.devices!.edges) {
    const obniz = edge!.node!;
    console.log(obniz.id);
    console.log(obniz.description);
    console.log(obniz.osVersion);
    console.log(obniz.deviceLiveInfo?.isOnline);
    break;
  }
}

getDevices("token_XXXXXXXXXX")
// for javascript
const getSdk = require('obniz-cloud-sdk').getSdk;

async function getDevices(token) {
  const obnizAPI = getSdk(token);
  const result = await obnizAPI.devices();
  for (const edge of result.devices.edges) {
    const obniz = edge.node;
    console.log(obniz.id);
    console.log(obniz.description);
    console.log(obniz.osVersion);
    console.log(obniz.deviceLiveInfo?.isOnline);
    break;
  }
}

getDevices("token_XXXXXXXXXX")

Readme

Keywords

Package Sidebar

Install

npm i obniz-cloud-sdk

Homepage

obniz.com/

Weekly Downloads

13

Version

2.0.0

License

ISC

Unpacked Size

198 kB

Total Files

18

Last publish

Collaborators

  • yukisato
  • kido