Created by lplit 215 days ago Viewed 30 times 0 Points
Note: Description borrowed from official documentation at https://github.com/octokit/plugin-rest-endpoint-methods.js/blob/master/docs/search/code.md)
Searches for query terms inside of a file. This method returns up to 100 results per page.
When searching for code, you can get text match metadata for the file content and file path fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
For example, if you want to find the definition of the addClass function inside jQuery repository, your query would look something like this:
q=addClass+in:file+language:js+repo:jquery/jquery
This query searches for the keyword addClass
within a file's contents. The query limits the search to files where the language is JavaScript in the jquery/jquery
repository.
No comments yet
import * as wmill from "https://deno.land/x/windmill@v1.34.0/mod.ts";
import { Octokit } from "https://cdn.skypack.dev/octokit?dts";
/*
@param: {wmill.Resource<"github">} gh_auth - Resource containing Github Auth API Key
example:
{
auth: github_api_key
}
*/
export async function main(
gh_auth: wmill.Resource<"github">,
query: string = "repo:windmill-labs/windmill+css",
sort?: string,
order?: string,
per_page?: number,
page?: number,
) {
const octokit = new Octokit(gh_auth);
const response = await octokit.rest.search.code({
q: query, sort: sort, order: order, per_page: per_page, page: page
});
return response;
}
No comments yet