Пример #1
0
        /// <summary>
        /// Change one specific edge definition.
        /// This will modify all occurrences of this definition in all graphs known to your database.
        /// PUT/_api/gharial/{graph}/edge/{definition}
        /// </summary>
        /// <param name="graphName"></param>
        /// <param name="collectionName"></param>
        /// <param name="body"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        public async Task <PutEdgeDefinitionResponse> PutEdgeDefinitionAsync(
            string graphName,
            string collectionName,
            PutEdgeDefinitionBody body,
            PutEdgeDefinitionQuery query = null)
        {
            string uriString = _graphApiPath + "/" +
                               WebUtility.UrlEncode(graphName) + "/edge/" +
                               WebUtility.UrlEncode(collectionName);

            if (query != null)
            {
                uriString += "?" + query.ToQueryString();
            }
            var content = GetContent(body, true, true);

            using (var response = await _transport.PutAsync(uriString, content))
            {
                if (response.IsSuccessStatusCode)
                {
                    var stream = await response.Content.ReadAsStreamAsync();

                    return(DeserializeJsonFromStream <PutEdgeDefinitionResponse>(stream));
                }
                throw await GetApiErrorException(response);
            }
        }
Пример #2
0
 /// <summary>
 /// Change one specific edge definition.
 /// This will modify all occurrences of this definition in all graphs known to your database.
 /// PUT/_api/gharial/{graph}/edge/{definition}
 /// </summary>
 /// <param name="graphName"></param>
 /// <param name="collectionName"></param>
 /// <param name="body"></param>
 /// <param name="query"></param>
 /// <returns></returns>
 public virtual async Task <PutEdgeDefinitionResponse> PutEdgeDefinitionAsync(
     string graphName,
     string collectionName,
     PutEdgeDefinitionBody body,
     PutEdgeDefinitionQuery query        = null,
     CancellationToken cancellationToken = default)
 {
     return(await PutRequestAsync(ApiRootPath + "/" +
                                  WebUtility.UrlEncode(graphName) + "/edge/" +
                                  WebUtility.UrlEncode(collectionName),
                                  response => new PutEdgeDefinitionResponse(response), body, query, cancellationToken));
 }