async Task <SearchResult> ReadResultAsync(SearchResultMetadata metadata) { var reader = this.response.XmlReader; if (reader.NodeType == XmlNodeType.Element && reader.Name == "results") { return(null); } Debug.Assert(reader.ReadState <= ReadState.Interactive, string.Concat("ReadState: ", reader.ReadState)); reader.MoveToElement(); reader.EnsureMarkup(XmlNodeType.Element, "result", "response"); if (reader.Name == "response") { await this.response.ThrowRequestExceptionAsync().ConfigureAwait(false); } var result = new SearchResult(metadata); await result.ReadXmlAsync(reader).ConfigureAwait(false); await reader.ReadAsync().ConfigureAwait(false); if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "results") { await reader.ReadAsync().ConfigureAwait(false); } else { reader.EnsureMarkup(XmlNodeType.Element, "result"); } return(result); }
async Task <SearchResultMetadata> ReadMetadataAsync() { var metadata = new SearchResultMetadata(); var reader = this.response.XmlReader; for (;;) { await metadata.ReadXmlAsync(reader).ConfigureAwait(false); if (metadata.FieldNames.Count > 0) { break; } Debug.Assert(reader.Name == "results" && (reader.IsEmptyElement || reader.NodeType == XmlNodeType.EndElement), "Expected: <results/> or </results>"); var isEmptyElement = reader.IsEmptyElement; var readerNodeType = reader.NodeType; await reader.ReadAsync().ConfigureAwait(false); if (isEmptyElement || readerNodeType == XmlNodeType.EndElement) { break; } } return(metadata); }
async Task <SearchResultMetadata> ReadMetadataAsync() { var metadata = new SearchResultMetadata(); await metadata.ReadXmlAsync(this.response.XmlReader).ConfigureAwait(false); return(metadata); }
SearchResultStream(Response response) { this.metadata = SearchResultMetadata.Missing; this.response = response; this.awaiter = new Awaiter(this); }
/// <summary> /// Initializes a new instance of the Splunk.Client.SearchResult class. /// </summary> /// <param name="metadata"> /// The metadata. /// </param> internal SearchResult(SearchResultMetadata metadata) { this.metadata = metadata; }