@oada/client
A lightweight client tool to interact with an OADA-compliant server
Last updated a month ago by aultac .
Apache-2.0 · Original npm · Tarball · package.json
$ cnpm install @oada/client 
SYNC missed versions from official npm registry.

@oada/client

A lightweight client tool for interacting with an OADA-complient server

@oada/client @oada/oada-cache
Language TypeScript JavaScript
Supported protocols websocket websocket, HTTP
Internal cache No Yes

Usage

Connect

var client = require("@oada/client")
var connection = await client.connect({
  domain: "api.oada.com",
  token: "abc"
})

GET

Single GET

var response = await connection.get({ path: '/bookmarks/test' })

Recursive GET

var dataTree = {
  "bookmarks": {
    "_type": "application/vnd.oada.bookmarks.1+json",
    "_rev": 0,
    "thing": {
      "_type": "application/json",
      "_rev": 0,
      "abc": {
        "*": {
          "_type": "application/json",
      	  "_rev": 0,
        }
      }
    }
  }
}
var response = await connection.get({
  path: '/bookmarks/thing',
  tree: dataTree
})

Watch

var response = await connection.get({
  path: '/bookmarks/test',
  watchCallback: d => {
    console.log(d);
  }
})

PUT

Single PUT

var response = await connection.put({
  path: "/bookmarks/test",
  data: { thing: "abc" },
  contentType: "application/json"
})

Tree PUT

var dataTree = {
  "bookmarks": {
    "_type": "application/vnd.oada.bookmarks.1+json",
    "_rev": 0,
    "thing": {
      "_type": "application/json",
      "_rev": 0,
      "abc": {
        "*": {
          "_type": "application/json",
      	  "_rev": 0,
        }
      }
    }
  }
}
var response = await connection.put({
  path: '/bookmarks/thing/abc/xyz/zzz',
  tree: dataTree,
  data: { test: "something" }
})

HEAD

var response = await connection.head({ path: '/bookmarks/test' })

Current Tags

  • 0.0.3                                ...           delete (3 months ago)
  • 1.0.4                                ...           latest (a month ago)

6 Versions

  • 1.0.4                                ...           a month ago
  • 1.0.3                                ...           a month ago
  • 1.0.2                                ...           3 months ago
  • 1.0.1                                ...           3 months ago
  • 1.0.0                                ...           3 months ago
  • 0.0.3                                ...           3 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 17
Dependencies (6)
Dev Dependencies (10)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |