public async Task <CursorResponse <T> > PostCursorAsync <T>(PostCursorBody cursorRequest) { var content = GetStringContent(cursorRequest, true, true); using (var response = await _client.PostAsync(_cursorApiPath, content)) { if (response.IsSuccessStatusCode) { var stream = await response.Content.ReadAsStreamAsync(); return(DeserializeJsonFromStream <CursorResponse <T> >(stream)); } throw await GetApiErrorException(response); } }
/// <summary> /// Execute an AQL query, creating a cursor which can be used to page query results. /// </summary> /// <param name="postCursorBody">Object encapsulating options and parameters of the query.</param> /// <returns></returns> public virtual async Task <CursorResponse <T> > PostCursorAsync <T>( PostCursorBody postCursorBody) { var content = GetContent(postCursorBody, new ApiClientSerializationOptions(true, true)); using (var response = await _client.PostAsync(_cursorApiPath, content)) { if (response.IsSuccessStatusCode) { var stream = await response.Content.ReadAsStreamAsync(); return(DeserializeJsonFromStream <CursorResponse <T> >(stream)); } throw await GetApiErrorException(response); } }
/// <summary> /// Execute an AQL query, creating a cursor which can be used to page query results. /// </summary> /// <param name="postCursorBody">Object encapsulating options and parameters of the query.</param> /// <param name="headerProperties">Optional. Additional Header properties.</param> /// <returns></returns> public virtual async Task <CursorResponse <T> > PostCursorAsync <T>( PostCursorBody postCursorBody, CursorHeaderProperties headerProperties = null) { var content = GetContent(postCursorBody, new ApiClientSerializationOptions(true, true)); var headerCollection = GetHeaderCollection(headerProperties); using (var response = await _client.PostAsync(_cursorApiPath, content, headerCollection).ConfigureAwait(false)) { if (response.IsSuccessStatusCode) { var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); return(DeserializeJsonFromStream <CursorResponse <T> >(stream)); } throw await GetApiErrorException(response).ConfigureAwait(false); } }
/// <summary> /// Execute an AQL query, creating a cursor which can be used to page query results. /// </summary> /// <param name="postCursorBody">Object encapsulating options and parameters of the query.</param> /// <param name="cancellationToken"></param> /// <returns></returns> public virtual async Task <CursorResponse <T> > PostCursorAsync <T>(PostCursorBody postCursorBody, CancellationToken cancellationToken = default) { return(await PostRequestAsync(ApiRootPath, response => new CursorResponse <T>(response), postCursorBody, null, cancellationToken)); }