internal List <Document> Get(string collection, string vertexId, ArangoEdgeDirection direction) { var request = new Request(RequestType.Edge, HttpMethod.Get); request.RelativeUri = string.Join("/", _apiUri + "s", collection); request.QueryString.Add("vertex", vertexId); request.QueryString.Add("direction", direction.ToString().ToLower()); var response = _connection.Process(request); var edges = new List <Document>(); switch (response.StatusCode) { case HttpStatusCode.OK: edges = response.Document.List <Document>("edges"); break; default: if (response.IsException) { throw new ArangoException( response.StatusCode, response.Document.String("driverErrorMessage"), response.Document.String("driverExceptionMessage"), response.Document.Object <Exception>("driverInnerException") ); } break; } return(edges); }
public ArangoQueryOperation EDGES(string collection, string vertexId, ArangoEdgeDirection edgeDirection, ArangoQueryOperation aql) { var etom = new Etom(); etom.Type = AQL.EDGES; var expression = new StringBuilder(collection + ", "); // if vertex is valid document ID/handle enclose it with single quotes // otherwise it's most probably variable which shouldn't be enclosed if (Document.IsId(vertexId)) { expression.Append("'" + vertexId + "'"); } else { expression.Append(vertexId); } expression.Append(", '"); switch (edgeDirection) { case ArangoEdgeDirection.In: expression.Append("inbound"); break; case ArangoEdgeDirection.Out: expression.Append("outbound"); break; case ArangoEdgeDirection.Any: expression.Append("any"); break; default: break; } expression.Append("'"); etom.Value = expression; etom.Children = aql.ExpressionTree; return(AddEtom(etom)); }
internal List<Document> Get(string collection, string vertexId, ArangoEdgeDirection direction) { var request = new Request(RequestType.Edge, HttpMethod.Get); request.RelativeUri = string.Join("/", _apiUri + "s", collection); request.QueryString.Add("vertex", vertexId); request.QueryString.Add("direction", direction.ToString().ToLower()); var response = _connection.Process(request); var edges = new List<Document>(); switch (response.StatusCode) { case HttpStatusCode.OK: edges = response.Document.List<Document>("edges"); break; default: if (response.IsException) { throw new ArangoException( response.StatusCode, response.Document.String("driverErrorMessage"), response.Document.String("driverExceptionMessage"), response.Document.Object<Exception>("driverInnerException") ); } break; } return edges; }
/// <summary> /// Retrieves list of edge documents from collection with specified direction. /// </summary> /// <param name="collection">Collection from which will be edges retrieved.</param> /// <param name="vertexId">Identifier of the start vertex.</param> /// <param name="direction">Direction of edges to retrieve.</param> public List <Document> Get(string collection, string vertexId, ArangoEdgeDirection direction = ArangoEdgeDirection.Any) { return(_edgeOperation.Get(collection, vertexId, direction)); }