1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Get search page
use osynic_osuapi::error::Result;
use osynic_osuapi::v2::client::request::client::OsynicOsuApiV2Client;
use osynic_osuapi::v2::interface::search::ISearch;
use osynic_osuapi::v2::model::oauth::structs::o_token::OToken;
#[tokio::main]
async fn main() -> Result<()> {
dotenvy::dotenv().ok();
let access_token = std::env::var("ACCESS_TOKEN").expect(
"Please set the ACCESS_TOKEN environment variable to a valid osu! API v2 access token",
);
let client = OsynicOsuApiV2Client::new(OToken {
access_token,
refresh_token: None,
expires_in: 86400,
token_type: "Bearer".to_string(),
});
let search = client
.search
.search(None, Some("Islatri".to_string()), Some(1))
.await?;
println!("{:?}", search);
Ok(())
}
/*
ReqwestSearch search
SearchResponse {
user: Some(UserSearchResponse {
data: [User {
avatar_url: "https://a.ppy.sh/31175842?1738717996.jpeg",
country_code: "CN",
default_group: Some("default"),
id: 31175842,
is_active: true,
is_bot: false,
is_deleted: false,
is_online: false,
is_supporter: false,
last_visit: "2025-05-10T15:41:06+00:00",
pm_friends_only: false,
profile_colour: None,
username: "Islatri"
}],
total: 1
}),
wiki_page: Some(WikiPageSearchResponse {
data: [],
total: 0
})
}
*/