Skip to content

Commit 52e9e4c

Browse files
committed
Add Graph API remove method to Graph collections
1 parent 7ec93ad commit 52e9e4c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/graph.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ class GraphVertexCollection extends BaseCollection {
1515
_documentPath(documentHandle) {
1616
return `document/${this._documentHandle(documentHandle)}`;
1717
}
18+
19+
remove(documentHandle, cb) {
20+
const {promise, callback} = this._connection.promisify(cb);
21+
this._gharial.delete(
22+
documentHandle,
23+
(err, res) => err ? callback(err) : callback(null, res.body)
24+
);
25+
return promise;
26+
}
1827

1928
vertex(documentHandle, cb) {
2029
const {promise, callback} = this._connection.promisify(cb);
@@ -43,6 +52,15 @@ class GraphEdgeCollection extends EdgeCollection {
4352
this.graph = graph;
4453
this._gharial = this._api.route(`gharial/${this.graph.name}/edge/${this.name}`);
4554
}
55+
56+
remove(documentHandle, cb) {
57+
const {promise, callback} = this._connection.promisify(cb);
58+
this._gharial.delete(
59+
documentHandle,
60+
(err, res) => err ? callback(err) : callback(null, res.body)
61+
);
62+
return promise;
63+
}
4664

4765
edge(documentHandle, cb) {
4866
const {promise, callback} = this._connection.promisify(cb);

0 commit comments

Comments
 (0)