@oada/client
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -35,3 +35,2 @@ "use strict"; | ||
constructor(domain, concurrency = 10) { | ||
console.log("domain", domain); | ||
this._domain = domain; | ||
@@ -38,0 +37,0 @@ this._requests = new Map(); |
{ | ||
"name": "@oada/client", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A lightweight client tool to interact with an OADA-compliant server", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,4 +17,4 @@ # @oada/client | ||
```javascript | ||
var client = require("@oada/client") | ||
var connection = await client.connect({ | ||
const client = require("@oada/client") | ||
const connection = await client.connect({ | ||
domain: "api.oada.com", | ||
@@ -30,3 +30,3 @@ token: "abc" | ||
```javascript | ||
var response = await connection.get({ | ||
const response = await connection.get({ | ||
path: '/bookmarks/test', | ||
@@ -40,3 +40,3 @@ timeout: 1000 // timeout in milliseconds (optional) | ||
``` javascript | ||
var dataTree = { | ||
const dataTree = { | ||
"bookmarks": { | ||
@@ -57,3 +57,3 @@ "_type": "application/vnd.oada.bookmarks.1+json", | ||
} | ||
var response = await connection.get({ | ||
const response = await connection.get({ | ||
path: '/bookmarks/thing', | ||
@@ -67,4 +67,5 @@ tree: dataTree, | ||
A watch request can be issued by passing a callback function to `watchCallback` argument of a GET request. | ||
```javascript | ||
var response = await connection.get({ | ||
const response = await connection.get({ | ||
path: '/bookmarks/test', | ||
@@ -78,2 +79,19 @@ watchCallback: d => { | ||
Alternatively, one could explicitly send a `watch` request as follows. | ||
```javascript | ||
const requestId = await connection.watch({ | ||
path: '/bookmarks/test', | ||
rev: 1, // optional | ||
watchCallback: d => { | ||
console.log(d); | ||
}, | ||
timeout: 1000 // timeout in milliseconds (optional) | ||
}) | ||
``` | ||
To unwatch a resource, use the `unwatch` request. | ||
```javascript | ||
const response = await connection.unwatch(requestId); | ||
``` | ||
### PUT | ||
@@ -84,3 +102,3 @@ | ||
```javascript | ||
var response = await connection.put({ | ||
const response = await connection.put({ | ||
path: "/bookmarks/test", | ||
@@ -96,3 +114,3 @@ data: { thing: "abc" }, | ||
``` javascript | ||
var dataTree = { | ||
const dataTree = { | ||
"bookmarks": { | ||
@@ -113,3 +131,3 @@ "_type": "application/vnd.oada.bookmarks.1+json", | ||
} | ||
var response = await connection.put({ | ||
const response = await connection.put({ | ||
path: '/bookmarks/thing/abc/xyz/zzz', | ||
@@ -125,3 +143,3 @@ tree: dataTree, | ||
```javascript | ||
var response = await connection.head({ | ||
const response = await connection.head({ | ||
path: '/bookmarks/test', | ||
@@ -128,0 +146,0 @@ timeout: 1000 // timeout in milliseconds (optional) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43386
139
652
1