public BatchSubRequest Search(string query) { if (string.IsNullOrEmpty(query)) { throw new ArgumentNullException(nameof(query)); } if (!query.Contains("FIND")) { throw new ArgumentException("query does not contain FIND"); } if (!query.Contains("{") || !query.Contains("}")) { throw new ArgumentException("search term must be wrapped in braces"); } var request = new BatchSubRequest { ResponseType = "query", Method = "GET", Url = $"search?q={Dnf.EscapeDataString(query)}" }; BatchRequests.Add(request); return(request); }
public BatchSubRequest ExplainAll(string query) { if (string.IsNullOrEmpty(query)) { throw new ArgumentNullException(nameof(query)); } var request = new BatchSubRequest { Method = "GET", Url = $"queryAll?explain={Dnf.EscapeDataString(query)}" }; BatchRequests.Add(request); return(request); }
public BatchSubRequest Query(string query) { if (string.IsNullOrEmpty(query)) { throw new ArgumentNullException(nameof(query)); } var request = new BatchSubRequest { ResponseType = "query", Method = "GET", Url = $"query?q={Dnf.EscapeDataString(query)}" }; BatchRequests.Add(request); return(request); }
public async IAsyncEnumerable <QueryResult <T> > SearchAsync <T>(string q) { if (string.IsNullOrEmpty(q)) { throw new ArgumentNullException(nameof(q)); } var resourceName = $"tooling/search?q={Dnf.EscapeDataString(q)}"; var result = await JsonHttp.HttpGetAsync <QueryResult <T> >(resourceName) .ConfigureAwait(false); await foreach (var nextResult in QueryByLocatorAsync(result) .ConfigureAwait(false)) { yield return(nextResult); } }
public CompositeSubRequest Explain(string referenceId, string query) { if (string.IsNullOrEmpty(referenceId)) { throw new ArgumentNullException(nameof(referenceId)); } if (string.IsNullOrEmpty(query)) { throw new ArgumentNullException(nameof(query)); } var request = new CompositeSubRequest { Method = "GET", ReferenceId = referenceId, Url = $@"query?explain={Dnf.EscapeDataString(query)}" }; CompositeRequests.Add(request); return(request); }