From 4d80d491d73b2c42be0dc4a58c9029ce8f4a3c71 Mon Sep 17 00:00:00 2001 From: Pierre-Yves FARE Date: Sun, 12 Jul 2020 22:28:58 +0100 Subject: [PATCH] Add method overloads with document ID. fix #146 --- .../GraphApi/GraphApiClientTest.cs | 285 +++++++++++++++--- arangodb-net-standard/ApiClientBase.cs | 6 + .../GraphApi/GraphApiClient.cs | 216 +++++++++++-- .../GraphApi/IGraphApiClient.cs | 110 ++++++- 4 files changed, 551 insertions(+), 66 deletions(-) diff --git a/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs b/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs index f3bd9703..edb66d3e 100644 --- a/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs +++ b/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs @@ -786,7 +786,7 @@ await _fixture.ArangoDBClient.Graph.PostGraphAsync(new PostGraphBody toClx, new { myKey = "myValue" }); - // Create the edge + // Create the edges var createEdgeResponse = await _client.PostEdgeAsync( graphName, @@ -802,12 +802,28 @@ await _fixture.ArangoDBClient.Graph.PostGraphAsync(new PostGraphBody ReturnNew = true, WaitForSync = true }); - // Delete edge + + var createEdgeResponse2 = await _client.PostEdgeAsync( + graphName, + edgeClx, + new + { + _from = fromResponse._id, + _to = toResponse._id, + myKey = "myValue" + }, + new PostEdgeQuery + { + ReturnNew = true, + WaitForSync = true + }); + + // Delete edge with document ID + DeleteEdgeResponse response = await _client.DeleteEdgeAsync( graphName, - edgeClx, - createEdgeResponse.Edge._key, + createEdgeResponse.Edge._id, new DeleteEdgeQuery { ReturnOld = true, @@ -818,6 +834,23 @@ await _client.DeleteEdgeAsync( Assert.Equal(createEdgeResponse.New.myKey, response.Old.myKey); Assert.True(response.Removed); Assert.False(response.Error); + + // Delete edge with collection name and key + + response = await _client.DeleteEdgeAsync( + graphName, + edgeClx, + createEdgeResponse2.Edge._key, + new DeleteEdgeQuery + { + ReturnOld = true, + WaitForSync = true + }); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.Equal(createEdgeResponse2.New.myKey, response.Old.myKey); + Assert.True(response.Removed); + Assert.False(response.Error); } [Fact] @@ -863,7 +896,21 @@ public async Task GetVertexAsync_ShouldSucceed() Name = clxToAdd + "_vtx" }); - var response = await _client.GetVertexAsync(graphName, clxToAdd, createVtxResponse.Vertex._key); + var response = await _client.GetVertexAsync( + graphName, + createVtxResponse.Vertex._id); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.False(response.Error); + Assert.NotNull(response.Vertex); + Assert.Equal(clxToAdd + "_vtx", response.Vertex.Name); + Assert.Equal(createVtxResponse.Vertex._key, response.Vertex._key); + Assert.Equal(createVtxResponse.Vertex._id, response.Vertex._id); + + response = await _client.GetVertexAsync( + graphName, + clxToAdd, + createVtxResponse.Vertex._key); Assert.Equal(HttpStatusCode.OK, response.Code); Assert.False(response.Error); @@ -966,6 +1013,8 @@ public async Task DeleteVertexAsync_ShouldSucceed() Collection = clxToAdd }); + // Create vertex + var vertexProperty = clxToAdd + "_vtx"; var createVtxResponse = await _client.PostVertexAsync(graphName, clxToAdd, new @@ -975,12 +1024,37 @@ public async Task DeleteVertexAsync_ShouldSucceed() Assert.Equal(HttpStatusCode.Accepted, createVtxResponse.Code); - var response = await _client.DeleteVertexAsync(graphName, clxToAdd, createVtxResponse.Vertex._key, new DeleteVertexQuery + var createVtxResponse2 = await _client.PostVertexAsync(graphName, clxToAdd, new { - ReturnOld = true, - WaitForSync = true + Name = vertexProperty }); + Assert.Equal(HttpStatusCode.Accepted, createVtxResponse2.Code); + + var response = await _client.DeleteVertexAsync( + graphName, + createVtxResponse.Vertex._id, + new DeleteVertexQuery + { + ReturnOld = true, + WaitForSync = true + }); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.False(response.Error); + Assert.True(response.Removed); + Assert.Equal(vertexProperty, response.Old.Name); + + response = await _client.DeleteVertexAsync( + graphName, + clxToAdd, + createVtxResponse2.Vertex._key, + new DeleteVertexQuery + { + ReturnOld = true, + WaitForSync = true + }); + Assert.Equal(HttpStatusCode.OK, response.Code); Assert.False(response.Error); Assert.True(response.Removed); @@ -1090,15 +1164,46 @@ public async Task PatchVertexAsync_ShouldSucceed() WaitForSync = true }); - var response = await _client.PatchVertexAsync(graphName, clxToAdd, createVtxResponse.Vertex._key, new - { - Name = clxToAdd + "_vtx_2" - }, new PatchVertexQuery - { - ReturnNew = true, - ReturnOld = true, - WaitForSync = true - }); + // Patch with document ID + + var response = await _client.PatchVertexAsync( + graphName, + createVtxResponse.Vertex._id, + new + { + Name = clxToAdd + "_vtx_2" + }, + new PatchVertexQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.False(response.Error); + Assert.NotNull(response.Vertex); + Assert.NotEqual(createVtxResponse.Vertex._rev, response.Vertex._rev); + Assert.NotEqual(createVtxResponse.Vertex._rev, response.New._rev); + Assert.NotEqual(createVtxResponse.New.Name, response.New.Name); + Assert.Equal(createVtxResponse.New.Value, response.New.Value); + + // Patch with collection name and document key + + response = await _client.PatchVertexAsync( + graphName, + clxToAdd, + createVtxResponse.Vertex._key, + new + { + Name = clxToAdd + "_vtx_3" + }, + new PatchVertexQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); Assert.Equal(HttpStatusCode.OK, response.Code); Assert.False(response.Error); @@ -1231,23 +1336,56 @@ await _fixture.ArangoDBClient.Graph.PostGraphAsync(new PostGraphBody WaitForSync = true }); - var response = await _client.PutEdgeAsync(graphName, edgeClx, createEdgeResponse.Edge._key, new - { - _from = fromResponse._id, - _to = toResponse._id, - myKey = "newValue" - }, new PutEdgeQuery - { - ReturnNew = true, - ReturnOld = true, - WaitForSync = true - }); + // Put with document ID + + var response = await _client.PutEdgeAsync( + graphName, + createEdgeResponse.Edge._id, + new + { + _from = fromResponse._id, + _to = toResponse._id, + myKey = "newValue" + }, + new PutEdgeQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); Assert.Equal(HttpStatusCode.OK, response.Code); Assert.Equal(createEdgeResponse.New.myKey, response.Old.myKey); Assert.NotEqual(createEdgeResponse.New.myKey, response.New.myKey); Assert.False(response.Error); Assert.NotEqual(response.Edge._rev, createEdgeResponse.Edge._rev); + + string previousValue = response.New.myKey; + + // Put with collection name and document key + + response = await _client.PutEdgeAsync( + graphName, + edgeClx, + createEdgeResponse.Edge._key, + new + { + _from = fromResponse._id, + _to = toResponse._id, + myKey = "newValue2" + }, + new PutEdgeQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.Equal(previousValue, response.Old.myKey); + Assert.NotEqual(createEdgeResponse.New.myKey, response.New.myKey); + Assert.False(response.Error); + Assert.NotEqual(response.Edge._rev, createEdgeResponse.Edge._rev); } [Fact] @@ -1547,10 +1685,11 @@ await _fixture.ArangoDBClient.Graph.PostGraphAsync(new PostGraphBody WaitForSync = true }); + // Patch with document ID + var response = await _client.PatchEdgeAsync( graphName, - edgeClx, - createEdgeResponse.Edge._key, + createEdgeResponse.Edge._id, new { _from = fromResponse._id, @@ -1570,6 +1709,34 @@ await _fixture.ArangoDBClient.Graph.PostGraphAsync(new PostGraphBody Assert.NotEqual(createEdgeResponse.Edge._rev, response.Edge._rev); Assert.Equal(createEdgeResponse.New.value, response.New.value); Assert.Equal(createEdgeResponse.New.value, response.Old.value); + + string previousValue = response.New.myKey; + + // Patch with collection name and document key + + response = await _client.PatchEdgeAsync( + graphName, + edgeClx, + createEdgeResponse.Edge._key, + new + { + _from = fromResponse._id, + _to = toResponse._id, + myKey = "newValue2" + }, new PatchEdgeQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.Equal(previousValue, response.Old.myKey); + Assert.NotEqual(createEdgeResponse.New.myKey, response.New.myKey); + Assert.False(response.Error); + Assert.NotEqual(createEdgeResponse.Edge._rev, response.Edge._rev); + Assert.Equal(createEdgeResponse.New.value, response.New.value); + Assert.Equal(createEdgeResponse.New.value, response.Old.value); } [Fact] @@ -1608,26 +1775,58 @@ public async Task PutVertexAsync_ShouldSuceed() Collection = vertexClx }); - var beforeVertexClxVtx = vertexClx + "_vtx"; - var afterVertexClxVtx = vertexClx + "_vtx_2"; + string initialValue = vertexClx + "_vtx"; + string putValue = vertexClx + "_vtx_2"; var createVertexResponse = await _client.PostVertexAsync(graphName, vertexClx, new { - Name = beforeVertexClxVtx - }); - var response = await _client.PutVertexAsync(graphName, vertexClx, createVertexResponse.Vertex._key, new PutVertexMockModel - { - Name = afterVertexClxVtx - }, new PutVertexQuery - { - ReturnNew = true, - ReturnOld = true, - WaitForSync = true + Name = initialValue }); + // Put with document ID + + var response = await _client.PutVertexAsync( + graphName, + createVertexResponse.Vertex._id, + new PutVertexMockModel + { + Name = putValue + }, + new PutVertexQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); + + Assert.Equal(HttpStatusCode.OK, response.Code); + Assert.False(response.Error); + Assert.Equal(putValue, response.New.Name); + Assert.NotEqual(response.New.Name, response.Old.Name); + Assert.NotEqual(createVertexResponse.Vertex._rev, response.Vertex._rev); + + // Put with collection name and document key + + putValue = vertexClx + "_vtx_3"; + + response = await _client.PutVertexAsync( + graphName, + vertexClx, + createVertexResponse.Vertex._key, + new PutVertexMockModel + { + Name = putValue + }, + new PutVertexQuery + { + ReturnNew = true, + ReturnOld = true, + WaitForSync = true + }); + Assert.Equal(HttpStatusCode.OK, response.Code); Assert.False(response.Error); - Assert.Equal(afterVertexClxVtx, response.New.Name); + Assert.Equal(putValue, response.New.Name); Assert.NotEqual(response.New.Name, response.Old.Name); Assert.NotEqual(createVertexResponse.Vertex._rev, response.Vertex._rev); } diff --git a/arangodb-net-standard/ApiClientBase.cs b/arangodb-net-standard/ApiClientBase.cs index 746fa42c..04931830 100644 --- a/arangodb-net-standard/ApiClientBase.cs +++ b/arangodb-net-standard/ApiClientBase.cs @@ -39,6 +39,12 @@ protected async Task GetApiErrorException(IApiClientResponse } } + /// + /// Checks whether the provided document ID is in the correct form + /// of "{collection}/{key}". + /// + /// The document ID is invalid + /// The document ID to validate. protected void ValidateDocumentId(string documentId) { if (documentId.Split('/').Length != 2) diff --git a/arangodb-net-standard/GraphApi/GraphApiClient.cs b/arangodb-net-standard/GraphApi/GraphApiClient.cs index 1f88f5db..03396e33 100644 --- a/arangodb-net-standard/GraphApi/GraphApiClient.cs +++ b/arangodb-net-standard/GraphApi/GraphApiClient.cs @@ -1,6 +1,7 @@ using ArangoDBNetStandard.GraphApi.Models; using ArangoDBNetStandard.Serialization; using ArangoDBNetStandard.Transport; +using System; using System.Net; using System.Threading.Tasks; @@ -448,14 +449,39 @@ public virtual async Task> GetEdgeAsync( /// The _key attribute of the edge. /// /// - public virtual async Task> DeleteEdgeAsync( + public virtual Task> DeleteEdgeAsync( string graphName, string collectionName, string edgeKey, DeleteEdgeQuery query = null) { + return DeleteEdgeAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey), + query); + + } + + /// + /// Removes an edge based on its document ID. + /// + /// Provided document ID is invalid. + /// The type of the edge that is returned in + /// if requested. + /// The name of the graph. + /// The document ID of the edge to delete. + /// + /// + public virtual async Task> DeleteEdgeAsync( + string graphName, + string documentId, + DeleteEdgeQuery query = null) + { + ValidateDocumentId(documentId); + string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + - "/edge/" + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey); + "/edge/" + documentId; + if (query != null) { uri += "?" + query.ToQueryString(); @@ -479,14 +505,36 @@ public virtual async Task> DeleteEdgeAsync( /// /// /// - public virtual async Task> GetVertexAsync( + public virtual Task> GetVertexAsync( string graphName, string collectionName, string vertexKey, GetVertexQuery query = null) { + return GetVertexAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + vertexKey, + query); + } + + /// + /// Gets a vertex based on its document ID. + /// + /// Provided document ID is invalid. + /// The name of the graph to get the vertex from. + /// The document ID of the vertex to retrieve. + /// + /// + public virtual async Task> GetVertexAsync( + string graphName, + string documentId, + GetVertexQuery query = null) + { + ValidateDocumentId(documentId); + string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + - "/vertex/" + WebUtility.UrlEncode(collectionName) + "/" + vertexKey; + "/vertex/" + documentId; + if (query != null) { uri += "?" + query.ToQueryString(); @@ -511,19 +559,41 @@ public virtual async Task> GetVertexAsync( /// /// /// - public virtual async Task> DeleteVertexAsync( + public virtual Task> DeleteVertexAsync( string graphName, string collectionName, string vertexKey, DeleteVertexQuery query = null) { + return DeleteVertexAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(vertexKey), + query); + } + + /// + /// Removes a vertex based on its document ID. + /// + /// Provided document ID is invalid. + /// The name of the graph to delete the vertex from. + /// The document ID of the vertex to delete. + /// + /// + public virtual async Task> DeleteVertexAsync( + string graphName, + string documentId, + DeleteVertexQuery query = null) + { + ValidateDocumentId(documentId); + string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + - "/vertex/" + WebUtility.UrlEncode(collectionName) + "/" + - WebUtility.UrlEncode(vertexKey); + "/vertex/" + documentId; + if (query != null) { uri += "?" + query.ToQueryString(); } + using (var response = await _transport.DeleteAsync(uri)) { if (response.IsSuccessStatusCode) @@ -549,19 +619,49 @@ public virtual async Task> DeleteVertexAsync( /// /// /// - public virtual async Task> PatchVertexAsync( + public virtual Task> PatchVertexAsync( string graphName, string collectionName, string vertexKey, T body, PatchVertexQuery query = null) { + return PatchVertexAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(vertexKey), + body, + query); + } + + /// + /// Updates the data of the specific vertex based on its document ID. + /// + /// Provided document ID is invalid. + /// Type of the patch object + /// Type of the returned document, only applies when + /// or + /// are used. + /// The name of the graph in which to update the vertex. + /// The document ID of the vertex to update. + /// + /// + /// + public virtual async Task> PatchVertexAsync( + string graphName, + string documentId, + T body, + PatchVertexQuery query = null) + { + ValidateDocumentId(documentId); + string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + - "/vertex/" + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(vertexKey); + "/vertex/" + documentId; + if (query != null) { uri += "?" + query.ToQueryString(); } + var content = GetContent(body, false, false); using (var response = await _transport.PatchAsync(uri, content)) { @@ -585,22 +685,47 @@ public virtual async Task> PatchVertexAsync( /// /// /// - public virtual async Task> PutEdgeAsync( + public virtual Task> PutEdgeAsync( string graphName, string collectionName, string edgeKey, T edge, PutEdgeQuery query = null) { - var content = GetContent(edge, false, false); + return PutEdgeAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey), + edge, + query); + } + + /// + /// Replaces the data of an edge based on its document ID. + /// + /// Provided document ID is invalid. + /// Type of the document used for the update. + /// The name of the graph in which to replace the edge. + /// The document ID of the edge to replace. + /// + /// + /// + public virtual async Task> PutEdgeAsync( + string graphName, + string documentId, + T edge, + PutEdgeQuery query = null) + { + ValidateDocumentId(documentId); string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + - "/edge/" + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey); + "/edge/" + documentId; if (query != null) { uri += "?" + query.ToQueryString(); } + + var content = GetContent(edge, false, false); using (var response = await _transport.PutAsync(uri, content)) { if (response.IsSuccessStatusCode) @@ -655,29 +780,54 @@ public virtual async Task PutEdgeDefinitionAsync( /// Type of the patch object used to perform a partial update of the edge document. /// Type of the returned edge document, /// when or query params are used. - /// - /// - /// + /// The name of the graph in which to update the edge. + /// The name of the edge collection. + /// The document key of the edge to update. /// /// /// - public virtual async Task> PatchEdgeAsync( + public virtual Task> PatchEdgeAsync( string graphName, string collectionName, string edgeKey, T edge, PatchEdgeQuery query = null) { - var content = GetContent(edge, true, true); + return PatchEdgeAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey), + edge, + query); + } + + /// + /// Updates the data of the specific edge based on its document ID. + /// + /// Type of the patch object used to perform a partial update of the edge document. + /// Type of the returned edge document, + /// when or query params are used. + /// The name of the graph in which to update the edge. + /// The document ID of the edge to update. + /// + /// + /// + public virtual async Task> PatchEdgeAsync( + string graphName, + string documentId, + T edge, + PatchEdgeQuery query = null) + { + ValidateDocumentId(documentId); string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + - "/edge/" + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey); + "/edge/" + documentId; if (query != null) { uri += "?" + query.ToQueryString(); } + var content = GetContent(edge, true, true); using (var response = await _transport.PatchAsync(uri, content)) { if (response.IsSuccessStatusCode) @@ -700,19 +850,45 @@ public virtual async Task> PatchEdgeAsync( /// /// /// - public virtual async Task> PutVertexAsync( + public virtual Task> PutVertexAsync( string graphName, string collectionName, string key, T vertex, PutVertexQuery query = null) { + return PutVertexAsync( + graphName, + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(key), + vertex, + query); + } + + /// + /// Replaces the data of a vertex based on its document ID. + /// + /// + /// The name of the graph in which to replace the vertex. + /// The document ID of the vertex to replace. + /// + /// + /// + public virtual async Task> PutVertexAsync( + string graphName, + string documentId, + T vertex, + PutVertexQuery query = null) + { + ValidateDocumentId(documentId); + string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + - "/vertex/" + WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(key); + "/vertex/" + documentId; + if (query != null) { uri += "?" + query.ToQueryString(); } + var content = GetContent(vertex, true, true); using (var response = await _transport.PutAsync(uri, content)) { diff --git a/arangodb-net-standard/GraphApi/IGraphApiClient.cs b/arangodb-net-standard/GraphApi/IGraphApiClient.cs index 16fd268c..ad313bea 100644 --- a/arangodb-net-standard/GraphApi/IGraphApiClient.cs +++ b/arangodb-net-standard/GraphApi/IGraphApiClient.cs @@ -209,6 +209,21 @@ Task> DeleteEdgeAsync( string edgeKey, DeleteEdgeQuery query = null); + /// + /// Removes an edge based on its document ID. + /// + /// The type of the edge that is returned in + /// if requested. + /// The name of the graph. + /// The document ID of the edge to delete. + /// + /// + Task> DeleteEdgeAsync( + string graphName, + string documentId, + DeleteEdgeQuery query = null); + + /// /// Gets a vertex from the given collection. /// GET/_api/gharial/{graph}/vertex/{collection}/{vertex} /// @@ -223,6 +238,18 @@ Task> GetVertexAsync( string vertexKey, GetVertexQuery query = null); + /// + /// Gets a vertex based on its document ID. + /// + /// The name of the graph to get the vertex from. + /// The document ID of the vertex to retrieve. + /// + /// + Task> GetVertexAsync( + string graphName, + string documentId, + GetVertexQuery query = null); + /// /// Removes a vertex from the collection. /// DELETE/_api/gharial/{graph}/vertex/{collection}/{vertex} @@ -238,6 +265,18 @@ Task> DeleteVertexAsync( string vertexKey, DeleteVertexQuery query = null); + /// + /// Removes a vertex based on its document ID. + /// + /// The name of the graph to delete the vertex from. + /// The document ID of the vertex to delete. + /// + /// + Task> DeleteVertexAsync( + string graphName, + string documentId, + DeleteVertexQuery query = null); + /// /// Updates the data of the specific vertex in the collection. /// PATCH/_api/gharial/{graph}/vertex/{collection}/{vertex} @@ -259,6 +298,24 @@ Task> PatchVertexAsync( T body, PatchVertexQuery query = null); + /// + /// Updates the data of the specific vertex based on its document ID. + /// + /// Type of the patch object + /// Type of the returned document, only applies when + /// or + /// are used. + /// The name of the graph in which to update the vertex. + /// The document ID of the vertex to update. + /// + /// + /// + Task> PatchVertexAsync( + string graphName, + string documentId, + T body, + PatchVertexQuery query = null); + /// /// Replaces the data of an edge in the collection. /// PUT /_api/gharial/{graph}/edge/{collection}/{edge} @@ -277,6 +334,21 @@ Task> PutEdgeAsync( T edge, PutEdgeQuery query = null); + /// + /// Replaces the data of an edge based on its document ID. + /// + /// Type of the document used for the update. + /// The name of the graph in which to replace the edge. + /// The document ID of the edge to replace. + /// + /// + /// + Task> PutEdgeAsync( + string graphName, + string documentId, + T edge, + PutEdgeQuery query = null); + /// /// Change one specific edge definition. /// This will modify all occurrences of this definition in all graphs known to your database. @@ -300,9 +372,9 @@ Task PutEdgeDefinitionAsync( /// Type of the patch object used to perform a partial update of the edge document. /// Type of the returned edge document, /// when or query params are used. - /// - /// - /// + /// The name of the graph in which to update the edge. + /// The name of the edge collection. + /// The document key of the edge to update. /// /// /// @@ -313,6 +385,23 @@ Task> PatchEdgeAsync( T edge, PatchEdgeQuery query = null); + /// + /// Updates the data of the specific edge based on its document ID. + /// + /// Type of the patch object used to perform a partial update of the edge document. + /// Type of the returned edge document, + /// when or query params are used. + /// The name of the graph in which to update the edge. + /// The document ID of the edge to update. + /// + /// + /// + Task> PatchEdgeAsync( + string graphName, + string documentId, + T edge, + PatchEdgeQuery query = null); + /// /// Replaces the data of a vertex in the collection. /// PUT/_api/gharial/{graph}/vertex/{collection}/{vertex} @@ -330,5 +419,20 @@ Task> PutVertexAsync( string key, T vertex, PutVertexQuery query = null); + + /// + /// Replaces the data of a vertex based on its document ID. + /// + /// + /// The name of the graph in which to replace the vertex. + /// The document ID of the vertex to replace. + /// + /// + /// + Task> PutVertexAsync( + string graphName, + string documentId, + T vertex, + PutVertexQuery query = null); } }