-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Missing TextMatches from SearchCodeResult #2747
Comments
While adding this with a PR isn't too hard if you want a quick hack around: public class OurSearchCode {
public class TextMatch {
public string fragment { get; private set; }
}
public TextMatch[] text_matches { get; private set; }
public string Name { get; private set; }
public string Path { get; private set; }
public string Sha { get; private set; }
public string Url { get; private set; }
public string GitUrl { get; private set; }
public string HtmlUrl { get; private set; }
public Repository Repository { get; private set; }
}
public class OurSearchCodeResult : SearchResult<OurSearchCode> {
public OurSearchCodeResult() { }
public OurSearchCodeResult(int totalCount, bool incompleteResults, IReadOnlyList<OurSearchCode> items)
: base(totalCount, incompleteResults, items) {
}
}
public async Task<OurSearchCodeResult> DoSearch(bool withProxy = false) {
var client = GetClient(withProxy);
var conn = (ApiConnection)typeof(ApiClient).InvokeMember("ApiConnection", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.Instance, null, client.Search, new object[0]);
var result = await conn.Get<OurSearchCodeResult>(ApiUrls.SearchCode(), request.Parameters, "application/vnd.github.text-match+json");
return result;
} you can add some of the other text search result args to the TextMatch class if desired as well |
👋 Hey Friends, this issue has been automatically marked as |
What happened?
When searching for code, you can request TextMatches by adding
application/vnd.github.text-match+json
to theAccept
header:https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#text-match-metadata
This will include
text_matches
in the response, currently they are not included in the response.Versions
Tested on C# 7.0.1
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: