@oada/client
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -163,3 +163,3 @@ "use strict"; | ||
? utils.createNestedObject(linkObj, relativePathArray) | ||
: undefined; | ||
: {}; | ||
const resourceId = await this._createResource(contentType, newResource); | ||
@@ -166,0 +166,0 @@ linkObj = |
{ | ||
"name": "@oada/client", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A lightweight client tool to interact with an OADA-compliant server", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
105
README.md
@@ -5,9 +5,8 @@ # @oada/client | ||
| | `@oada/client` | `@oada/oada-cache` | | ||
| --- | --- | --- | | ||
| Language | TypeScript | JavaScript | | ||
| Supported protocols | websocket | websocket, HTTP | | ||
| Internal cache | No | Yes | | ||
| | `@oada/client` | `@oada/oada-cache` | | ||
| ------------------- | -------------- | ------------------ | | ||
| Language | TypeScript | JavaScript | | ||
| Supported protocols | websocket | websocket, HTTP | | ||
| Internal cache | No | Yes | | ||
## Usage | ||
@@ -18,7 +17,7 @@ | ||
```javascript | ||
var client = require("@oada/client") | ||
var client = require("@oada/client"); | ||
var connection = await client.connect({ | ||
domain: "api.oada.com", | ||
token: "abc" | ||
}) | ||
token: "abc", | ||
}); | ||
``` | ||
@@ -31,3 +30,3 @@ | ||
```javascript | ||
var response = await connection.get({ path: '/bookmarks/test' }) | ||
var response = await connection.get({ path: "/bookmarks/test" }); | ||
``` | ||
@@ -37,23 +36,23 @@ | ||
``` javascript | ||
```javascript | ||
var dataTree = { | ||
"bookmarks": { | ||
"_type": "application/vnd.oada.bookmarks.1+json", | ||
"_rev": 0, | ||
"thing": { | ||
"_type": "application/json", | ||
"_rev": 0, | ||
"abc": { | ||
bookmarks: { | ||
_type: "application/vnd.oada.bookmarks.1+json", | ||
_rev: 0, | ||
thing: { | ||
_type: "application/json", | ||
_rev: 0, | ||
abc: { | ||
"*": { | ||
"_type": "application/json", | ||
"_rev": 0, | ||
} | ||
} | ||
} | ||
} | ||
} | ||
_type: "application/json", | ||
_rev: 0, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
var response = await connection.get({ | ||
path: '/bookmarks/thing', | ||
tree: dataTree | ||
}) | ||
path: "/bookmarks/thing", | ||
tree: dataTree, | ||
}); | ||
``` | ||
@@ -65,7 +64,7 @@ | ||
var response = await connection.get({ | ||
path: '/bookmarks/test', | ||
watchCallback: d => { | ||
path: "/bookmarks/test", | ||
watchCallback: (d) => { | ||
console.log(d); | ||
} | ||
}) | ||
}, | ||
}); | ||
``` | ||
@@ -81,4 +80,4 @@ | ||
data: { thing: "abc" }, | ||
contentType: "application/json" | ||
}) | ||
contentType: "application/json", | ||
}); | ||
``` | ||
@@ -88,24 +87,24 @@ | ||
``` javascript | ||
```javascript | ||
var dataTree = { | ||
"bookmarks": { | ||
"_type": "application/vnd.oada.bookmarks.1+json", | ||
"_rev": 0, | ||
"thing": { | ||
"_type": "application/json", | ||
"_rev": 0, | ||
"abc": { | ||
bookmarks: { | ||
_type: "application/vnd.oada.bookmarks.1+json", | ||
_rev: 0, | ||
thing: { | ||
_type: "application/json", | ||
_rev: 0, | ||
abc: { | ||
"*": { | ||
"_type": "application/json", | ||
"_rev": 0, | ||
} | ||
} | ||
} | ||
} | ||
} | ||
_type: "application/json", | ||
_rev: 0, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
var response = await connection.put({ | ||
path: '/bookmarks/thing/abc/xyz/zzz', | ||
path: "/bookmarks/thing/abc/xyz/zzz", | ||
tree: dataTree, | ||
data: { test: "something" } | ||
}) | ||
data: { test: "something" }, | ||
}); | ||
``` | ||
@@ -116,3 +115,3 @@ | ||
```javascript | ||
var response = await connection.head({ path: '/bookmarks/test' }) | ||
var response = await connection.head({ path: "/bookmarks/test" }); | ||
``` |
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
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
36998
110