Ejemplo n.º 1
0
 /// <summary>
 /// Adds a vertex collection to the set of orphan collections of the graph.
 /// If the collection does not exist, it will be created.
 /// POST /_api/gharial/{graph}/vertex
 /// </summary>
 /// <param name="graphName">The name of the graph.</param>
 /// <param name="body">The information of the vertex collection.</param>
 /// <returns></returns>
 public virtual async Task <PostVertexCollectionResponse> PostVertexCollectionAsync(
     string graphName,
     PostVertexCollectionBody body,
     CancellationToken cancellationToken = default)
 {
     return(await PostRequestAsync($"{ApiRootPath}{'/'}{WebUtility.UrlEncode(graphName)}/vertex",
                                   response => new PostVertexCollectionResponse(response), body, null, cancellationToken));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a vertex collection to the set of orphan collections of the graph.
        /// If the collection does not exist, it will be created.
        /// POST /_api/gharial/{graph}/vertex
        /// </summary>
        /// <param name="graphName">The name of the graph.</param>
        /// <param name="body">The information of the vertex collection.</param>
        /// <returns></returns>
        public async Task <PostVertexCollectionResponse> PostVertexCollectionAsync(
            string graphName,
            PostVertexCollectionBody body)
        {
            string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + "/vertex";

            var content = GetContent(body, true, true);

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

                    return(DeserializeJsonFromStream <PostVertexCollectionResponse>(stream));
                }
                throw await GetApiErrorException(response);
            }
        }