Struct roctogen::endpoints::search::Search [−][src]
pub struct Search<'api> { /* fields omitted */ }
Implementations
impl<'api> Search<'api>
[src]
impl<'api> Search<'api>
[src]pub async fn code_async(
&self,
query_params: impl Into<SearchCodeParams<'api>>
) -> Result<GetSearchCodeResponse200, SearchCodeError>
[src]
pub async fn code_async(
&self,
query_params: impl Into<SearchCodeParams<'api>>
) -> Result<GetSearchCodeResponse200, SearchCodeError>
[src]Search code
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.
Considerations for code search
Due to the complexity of searching code, there are a few restrictions on how searches are performed:
- Only the default branch is considered. In most cases, this will be the
master
branch. - Only files smaller than 384 KB are searchable.
- You must always include at least one search term when searching source code. For example, searching for
language:go
is not valid, whileamazing language:go
is.
pub fn code(
&self,
query_params: impl Into<SearchCodeParams<'api>>
) -> Result<GetSearchCodeResponse200, SearchCodeError>
[src]
pub fn code(
&self,
query_params: impl Into<SearchCodeParams<'api>>
) -> Result<GetSearchCodeResponse200, SearchCodeError>
[src]Search code
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.
Considerations for code search
Due to the complexity of searching code, there are a few restrictions on how searches are performed:
- Only the default branch is considered. In most cases, this will be the
master
branch. - Only files smaller than 384 KB are searchable.
- You must always include at least one search term when searching source code. For example, searching for
language:go
is not valid, whileamazing language:go
is.
pub async fn commits_async(
&self,
query_params: impl Into<SearchCommitsParams<'api>>
) -> Result<GetSearchCommitsResponse200, SearchCommitsError>
[src]
pub async fn commits_async(
&self,
query_params: impl Into<SearchCommitsParams<'api>>
) -> Result<GetSearchCommitsResponse200, SearchCommitsError>
[src]Search commits
Find commits via various criteria on the default branch (usually master
). This method returns up to 100 results per page.
When searching for commits, you can get text match metadata for the message field when you provide 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 commits related to CSS in the octocat/Spoon-Knife repository. Your query would look something like this:
q=repo:octocat/Spoon-Knife+css
The commits_async
endpoint is enabled with the cloak
cargo feature.
pub fn commits(
&self,
query_params: impl Into<SearchCommitsParams<'api>>
) -> Result<GetSearchCommitsResponse200, SearchCommitsError>
[src]
pub fn commits(
&self,
query_params: impl Into<SearchCommitsParams<'api>>
) -> Result<GetSearchCommitsResponse200, SearchCommitsError>
[src]Search commits
Find commits via various criteria on the default branch (usually master
). This method returns up to 100 results per page.
When searching for commits, you can get text match metadata for the message field when you provide 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 commits related to CSS in the octocat/Spoon-Knife repository. Your query would look something like this:
q=repo:octocat/Spoon-Knife+css
The commits
endpoint is enabled with the cloak
cargo feature.
pub async fn issues_and_pull_requests_async(
&self,
query_params: impl Into<SearchIssuesAndPullRequestsParams<'api>>
) -> Result<GetSearchIssuesAndPullRequestsResponse200, SearchIssuesAndPullRequestsError>
[src]
pub async fn issues_and_pull_requests_async(
&self,
query_params: impl Into<SearchIssuesAndPullRequestsParams<'api>>
) -> Result<GetSearchIssuesAndPullRequestsResponse200, SearchIssuesAndPullRequestsError>
[src]Search issues and pull requests
Find issues by state and keyword. This method returns up to 100 results per page.
When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body 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 oldest unresolved Python bugs on Windows. Your query might look something like this.
q=windows+label:bug+language:python+state:open&sort=created&order=asc
This query searches for the keyword windows
, within any open issue that is labeled as bug
. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results.
Note: For user-to-server GitHub App requests, you can’t retrieve a combination of issues and pull requests in a single query. Requests that don’t include the is:issue
or is:pull-request
qualifier will receive an HTTP 422 Unprocessable Entity
response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the is
qualifier, see “Searching only issues or pull requests.”
GitHub API docs for issues_and_pull_requests
pub fn issues_and_pull_requests(
&self,
query_params: impl Into<SearchIssuesAndPullRequestsParams<'api>>
) -> Result<GetSearchIssuesAndPullRequestsResponse200, SearchIssuesAndPullRequestsError>
[src]
pub fn issues_and_pull_requests(
&self,
query_params: impl Into<SearchIssuesAndPullRequestsParams<'api>>
) -> Result<GetSearchIssuesAndPullRequestsResponse200, SearchIssuesAndPullRequestsError>
[src]Search issues and pull requests
Find issues by state and keyword. This method returns up to 100 results per page.
When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body 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 oldest unresolved Python bugs on Windows. Your query might look something like this.
q=windows+label:bug+language:python+state:open&sort=created&order=asc
This query searches for the keyword windows
, within any open issue that is labeled as bug
. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results.
Note: For user-to-server GitHub App requests, you can’t retrieve a combination of issues and pull requests in a single query. Requests that don’t include the is:issue
or is:pull-request
qualifier will receive an HTTP 422 Unprocessable Entity
response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the is
qualifier, see “Searching only issues or pull requests.”
GitHub API docs for issues_and_pull_requests
pub async fn labels_async(
&self,
query_params: impl Into<SearchLabelsParams<'api>>
) -> Result<GetSearchLabelsResponse200, SearchLabelsError>
[src]
pub async fn labels_async(
&self,
query_params: impl Into<SearchLabelsParams<'api>>
) -> Result<GetSearchLabelsResponse200, SearchLabelsError>
[src]Search labels
Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results per page.
When searching for labels, you can get text match metadata for the label name and description 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 labels in the linguist
repository that match bug
, defect
, or enhancement
. Your query might look like this:
q=bug+defect+enhancement&repository_id=64778136
The labels that best match the query appear first in the search results.
pub fn labels(
&self,
query_params: impl Into<SearchLabelsParams<'api>>
) -> Result<GetSearchLabelsResponse200, SearchLabelsError>
[src]
pub fn labels(
&self,
query_params: impl Into<SearchLabelsParams<'api>>
) -> Result<GetSearchLabelsResponse200, SearchLabelsError>
[src]Search labels
Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results per page.
When searching for labels, you can get text match metadata for the label name and description 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 labels in the linguist
repository that match bug
, defect
, or enhancement
. Your query might look like this:
q=bug+defect+enhancement&repository_id=64778136
The labels that best match the query appear first in the search results.
pub async fn repos_async(
&self,
query_params: impl Into<SearchReposParams<'api>>
) -> Result<GetSearchReposResponse200, SearchReposError>
[src]
pub async fn repos_async(
&self,
query_params: impl Into<SearchReposParams<'api>>
) -> Result<GetSearchReposResponse200, SearchReposError>
[src]Search repositories
Find repositories via various criteria. This method returns up to 100 results per page.
When searching for repositories, you can get text match metadata for the name and description 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 search for popular Tetris repositories written in assembly code, your query might look like this:
q=tetris+language:assembly&sort=stars&order=desc
This query searches for repositories with the word tetris
in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results.
When you include the mercy
preview header, you can also search for multiple topics by adding more topic:
instances. For example, your query might look like this:
q=topic:ruby+topic:rails
The repos_async
endpoint is enabled with the mercy
cargo feature.
pub fn repos(
&self,
query_params: impl Into<SearchReposParams<'api>>
) -> Result<GetSearchReposResponse200, SearchReposError>
[src]
pub fn repos(
&self,
query_params: impl Into<SearchReposParams<'api>>
) -> Result<GetSearchReposResponse200, SearchReposError>
[src]Search repositories
Find repositories via various criteria. This method returns up to 100 results per page.
When searching for repositories, you can get text match metadata for the name and description 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 search for popular Tetris repositories written in assembly code, your query might look like this:
q=tetris+language:assembly&sort=stars&order=desc
This query searches for repositories with the word tetris
in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results.
When you include the mercy
preview header, you can also search for multiple topics by adding more topic:
instances. For example, your query might look like this:
q=topic:ruby+topic:rails
The repos
endpoint is enabled with the mercy
cargo feature.
pub async fn topics_async(
&self,
query_params: impl Into<SearchTopicsParams<'api>>
) -> Result<GetSearchTopicsResponse200, SearchTopicsError>
[src]
pub async fn topics_async(
&self,
query_params: impl Into<SearchTopicsParams<'api>>
) -> Result<GetSearchTopicsResponse200, SearchTopicsError>
[src]Search topics
Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results per page. See “Searching topics” for a detailed list of qualifiers.
When searching for topics, you can get text match metadata for the topic’s short_description, description, name, or display_name field 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 search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this:
q=ruby+is:featured
This query searches for topics with the keyword ruby
and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results.
The topics_async
endpoint is enabled with the mercy
cargo feature.
pub fn topics(
&self,
query_params: impl Into<SearchTopicsParams<'api>>
) -> Result<GetSearchTopicsResponse200, SearchTopicsError>
[src]
pub fn topics(
&self,
query_params: impl Into<SearchTopicsParams<'api>>
) -> Result<GetSearchTopicsResponse200, SearchTopicsError>
[src]Search topics
Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results per page. See “Searching topics” for a detailed list of qualifiers.
When searching for topics, you can get text match metadata for the topic’s short_description, description, name, or display_name field 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 search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this:
q=ruby+is:featured
This query searches for topics with the keyword ruby
and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results.
The topics
endpoint is enabled with the mercy
cargo feature.
pub async fn users_async(
&self,
query_params: impl Into<SearchUsersParams<'api>>
) -> Result<GetSearchUsersResponse200, SearchUsersError>
[src]
pub async fn users_async(
&self,
query_params: impl Into<SearchUsersParams<'api>>
) -> Result<GetSearchUsersResponse200, SearchUsersError>
[src]Search users
Find users via various criteria. This method returns up to 100 results per page.
When searching for users, you can get text match metadata for the issue login, email, and name fields when you pass the text-match
media type. For more details about highlighting search results, see Text match metadata. For more details about how to receive highlighted search results, see Text match metadata.
For example, if you’re looking for a list of popular users, you might try this query:
q=tom+repos:%3E42+followers:%3E1000
This query searches for users with the name tom
. The results are restricted to users with more than 42 repositories and over 1,000 followers.
pub fn users(
&self,
query_params: impl Into<SearchUsersParams<'api>>
) -> Result<GetSearchUsersResponse200, SearchUsersError>
[src]
pub fn users(
&self,
query_params: impl Into<SearchUsersParams<'api>>
) -> Result<GetSearchUsersResponse200, SearchUsersError>
[src]Search users
Find users via various criteria. This method returns up to 100 results per page.
When searching for users, you can get text match metadata for the issue login, email, and name fields when you pass the text-match
media type. For more details about highlighting search results, see Text match metadata. For more details about how to receive highlighted search results, see Text match metadata.
For example, if you’re looking for a list of popular users, you might try this query:
q=tom+repos:%3E42+followers:%3E1000
This query searches for users with the name tom
. The results are restricted to users with more than 42 repositories and over 1,000 followers.