Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new graph in the graph module.
 /// POST /_api/gharial
 /// </summary>
 /// <param name="postGraphBody">The information of the graph to create.</param>
 /// <returns></returns>
 public virtual async Task <PostGraphResponse> PostGraphAsync(
     PostGraphBody postGraphBody,
     PostGraphQuery query = null,
     CancellationToken cancellationToken = default)
 {
     return(await PostRequestAsync(ApiRootPath, response => new PostGraphResponse(response), postGraphBody, query,
                                   cancellationToken));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new graph in the graph module.
        /// </summary>
        /// <param name="postGraphBody">The information of the graph to create.</param>
        /// <returns></returns>
        public async Task <PostGraphResponse> PostGraph(PostGraphBody postGraphBody)
        {
            var content = GetStringContent(postGraphBody, true, true);

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

                    return(DeserializeJsonFromStream <PostGraphResponse>(stream));
                }
                throw await GetApiErrorException(response);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new graph in the graph module.
        /// POST /_api/gharial
        /// </summary>
        /// <param name="postGraphBody">The information of the graph to create.</param>
        /// <returns></returns>
        public async Task <PostGraphResponse> PostGraphAsync(
            PostGraphBody postGraphBody,
            PostGraphQuery query = null)
        {
            string uri = _graphApiPath;

            if (query != null)
            {
                uri += "?" + query.ToQueryString();
            }

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

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

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