gitea_sdk/api/search/mod.rs
1pub mod issues;
2pub mod repos;
3pub mod users;
4
5pub struct Search;
6
7impl Search {
8 /// Searches for repositories based on the given search options.
9 /// All fields in the [SearchRepositoriesOption] are optional.
10 /// This method will return a list of repositories that match the search criteria.
11 ///
12 /// # Example
13 /// ```
14 /// # use gitea_sdk::{Client, Auth};
15 /// # async fn search_repos() {
16 /// let client = Client::new(
17 /// "https://gitea.example.com",
18 /// Auth::Token("your-token")
19 /// );
20 /// let repo = client
21 /// .search()
22 /// .repos()
23 /// .query("my-repo")
24 /// .send(&client)
25 /// .await
26 /// .unwrap();
27 /// # }
28 /// ```
29 /// This will search for repositories matching the keyword "my-repo".
30 /// The search will include the repository description and will return the first page of
31 /// result.
32 pub fn repos(&self) -> repos::SearchRepositoriesBuilder {
33 repos::SearchRepositoriesBuilder::new()
34 }
35
36 /// Searches for users based on the given search options.
37 /// This method will return a list of users that match the search criteria.
38 ///
39 /// # Example
40 /// ```
41 /// # use gitea_sdk::{Client, Auth};
42 /// # async fn search_users() {
43 /// let client = Client::new(
44 /// "https://gitea.example.com",
45 /// Auth::Token("your-token")
46 /// );
47 /// let users = client
48 /// .search()
49 /// .users()
50 /// .query("my-user")
51 /// .send(&client)
52 /// .await
53 /// .unwrap();
54 /// # }
55 /// ```
56 pub fn users(&self) -> users::SearchUsersBuilder {
57 users::SearchUsersBuilder::new()
58 }
59
60 /// Searches for issues based on the given search options.
61 /// This method will return a list of issues that match the search criteria.
62 ///
63 /// # Example
64 /// ```
65 /// # use gitea_sdk::{Client, Auth};
66 /// # async fn search_issues() {
67 /// let client = Client::new(
68 /// "https://gitea.example.com",
69 /// Auth::Token("your-token")
70 /// );
71 /// let issues = client
72 /// .search()
73 /// .issues()
74 /// .query("my-issue")
75 /// .send(&client)
76 /// .await
77 /// .unwrap();
78 /// # }
79 /// ```
80 /// This will search for issues matching the keyword "my-issue".
81 pub fn issues(&self) -> issues::SearchIssuesBuilder {
82 issues::SearchIssuesBuilder::new()
83 }
84}