// Get user information by id or username
use osynic_osuapi::error::Result;
use osynic_osuapi::v2::client::request::client::OsynicOsuApiV2Client;
use osynic_osuapi::v2::interface::users::IUsers;
use osynic_osuapi::v2::model::oauth::structs::o_token::OToken;
use osynic_osuapi::v2::model::score::enums::score_type::ScoreType;

#[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 scores = client
        .users
        .get_user_scores(31175842, ScoreType::Best, None, None, None)
        .await?;
    println!("{:?}", scores);
    Ok(())
}

/*
ReqwestUsers get_user_scores
[Score {
    accuracy: 0.9883720930232558,
    best_id: Some(219374634),
    created_at: "2024-12-29T13:27:41Z",
    id: 219374634,
    max_combo: 230,
    mode: Catch,
    mode_int: 2,
    mods: [],
    passed: true,
    perfect: false,
    pp: 36.7791,
    rank: S,
    replay: true,
    score: 1557194,
    statistics: Statistics {
        count_100: 4,
        count_300: 320,
        count_50: 271,
        count_geki: None,
        count_katu: 6,
        count_miss: 1
    },
    ranking_type: "score_best_fruits",
    user_id: 31175842,
    current_user_attributes: CurrentUserAttributes {
        pin: None
    },
    beatmap: Some(Beatmap {
        beatmapset_id: 1532668,
        difficulty_rating: 2.25,
        id: 3134382,
        mode: Catch,
        status: Ranked,
        total_length: 89,
        user_id: 14057792,
        version: "Salad",
        accuracy: 7.0,
        ar: 7.0,
        bpm: 139.5,
        convert: false,
        count_circles: 95,
        count_sliders: 105,
        count_spinners: 1,
        cs: 3.0,
        deleted_at: None,
        drain: 3.0,
        hit_length: 89,
        is_scoreable: true,
        last_updated: "2021-08-19T02:58:34Z",
        mode_int: 2,
        passcount: 1728,
        playcount: 6517,
        ranked: 1,
        url: "https://osu.ppy.sh/beatmaps/3134382",
        checksum: "9422911fe9b4711fb50ea90b6dc23bee",
        max_combo: None,
        beatmapset: None,
        current_user_tag_ids: None,
        failtimes: None,
        owners: None,
        top_tag_ids: None
    }),
    user: Some(User {
        avatar_url: "https://a.ppy.sh/31175842?1738717996.jpeg",
        country_code: "CN",
        default_group: "default",
        id: 31175842,
        is_active: true,
        is_bot: false,
        is_deleted: false,
        is_online: false,
        is_supporter: false,
        last_visit: "2025-05-11T12:46:15+00:00",
        pm_friends_only: false,
        profile_colour: None,
        username: "Islatri",
        country: None,
        cover: None,
        team: None
    }),
    beatmapset: Some(Beatmapset {
        artist: "fripSide",
        artist_unicode: "fripSide",
        covers: Covers {
            cover: "https://assets.ppy.sh/beatmaps/1532668/covers/cover.jpg?1629341931",
            cover_2x: "https://assets.ppy.sh/beatmaps/1532668/covers/cover@2x.jpg?1629341931",
            card: "https://assets.ppy.sh/beatmaps/1532668/covers/card.jpg?1629341931",
            card_2x: "https://assets.ppy.sh/beatmaps/1532668/covers/card@2x.jpg?1629341931",
            list: "https://assets.ppy.sh/beatmaps/1532668/covers/list.jpg?1629341931",
            list_2x: "https://assets.ppy.sh/beatmaps/1532668/covers/list@2x.jpg?1629341931",
            slimcover: "https://assets.ppy.sh/beatmaps/1532668/covers/slimcover.jpg?1629341931",
            slimcover_2x: "https://assets.ppy.sh/beatmaps/1532668/covers/slimcover@2x.jpg?1629341931"
        },
        creator: "Souvenir",
        favourite_count: 156,
        hype: None,
        id: 1532668,
        nsfw: false,
        offset: 0,
        play_count: 55301,
        preview_url: "//b.ppy.sh/preview/1532668.mp3",
        source: "とある科学の超電磁砲",
        spotlight: false,
        status: Ranked,
        title: "LEVEL5 -judgelight- (TV Size)",
        title_unicode: "LEVEL5 -judgelight- (TV Size)",
        track_id: None,
        user_id: 14057792,
        video: true,
        bpm: None,
        can_be_hyped: None,
        deleted_at: None,
        discussion_enabled: None,
        discussion_locked: None,
        is_scoreable: None,
        last_updated: None,
        legacy_thread_url: None,
        nominations_summary: None,
        ranked: None,
        ranked_date: None,
        storyboard: None,
        submitted_date: None,
        tags: None,
        availability: None,
        beatmaps: None,
        pack_tags: None,
        converts: None,
        current_nominations: None,
        description: None,
        genre: None,
        language: None,
        ratings: None,
        recent_favourites: None,
        related_users: None,
        related_tags: None,
        user: None
    }),
    weight: Some(Weight {
        percentage: 100.0,
        pp: 36.7791
    })
}, Score {
    accuracy: 0.9924242424242424,
    best_id: Some(220068199),
    created_at: "2025-03-06T07:19:29Z",
    id: 220068199,
    max_combo: 316,
    mode: Catch,
    mode_int: 2,
    mods: [],
    passed: true,
    perfect: false,
    pp: 30.0524,
    rank: S,
    replay: true,
    score: 2666614,
    statistics: Statistics {
        count_100: 2,
        count_300: 404,
        count_50: 249,
        count_geki: None,
        count_katu: 2,
        count_miss: 3
    },
    ranking_type: "score_best_fruits",
    user_id: 31175842,
    current_user_attributes: CurrentUserAttributes {
        pin: None
    },
    beatmap: Some(Beatmap {
        beatmapset_id: 2115769,
        difficulty_rating: 2.02,
        id: 4443140,
        mode: Catch,
        status: Ranked,
        total_length: 83,
        user_id: 11251594,
        version: "sharpay's Hard",
        accuracy: 6.0,
        ar: 8.0,
        bpm: 180.0,
        convert: true,
        count_circles: 122,
        count_sliders: 136,
        count_spinners: 2,
        cs: 3.7,
        deleted_at: None,
        drain: 5.0,
        hit_length: 82,
        is_scoreable: true,
        last_updated: "2024-01-14T17:37:22Z",
        mode_int: 2,
        passcount: 36970,
        playcount: 117442,
        ranked: 1,
        url: "https://osu.ppy.sh/beatmaps/4443140",
        checksum: "f7605cf2ae17e8c3ec0495ab0b7b717d",
        max_combo: None,
        beatmapset: None,
        current_user_tag_ids: None,
        failtimes: None,
        owners: None,
        top_tag_ids: None
    }),
    user: Some(User {
        avatar_url: "https://a.ppy.sh/31175842?1738717996.jpeg",
        country_code: "CN",
        default_group: "default",
        id: 31175842,
        is_active: true,
        is_bot: false,
        is_deleted: false,
        is_online: false,
        is_supporter: false,
        last_visit: "2025-05-11T12:46:15+00:00",
        pm_friends_only: false,
        profile_colour: None,
        username: "Islatri",
        country: None,
        cover: None,
        team: None
    }),
    beatmapset: Some(Beatmapset {
        artist: "Atarayo",
        artist_unicode: "あたらよ",
        covers: Covers {
            cover: "https://assets.ppy.sh/beatmaps/2115769/covers/cover.jpg?1705253861",
            cover_2x: "https://assets.ppy.sh/beatmaps/2115769/covers/cover@2x.jpg?1705253861",
            card: "https://assets.ppy.sh/beatmaps/2115769/covers/card.jpg?1705253861",
            card_2x: "https://assets.ppy.sh/beatmaps/2115769/covers/card@2x.jpg?1705253861",
            list: "https://assets.ppy.sh/beatmaps/2115769/covers/list.jpg?1705253861",
            list_2x: "https://assets.ppy.sh/beatmaps/2115769/covers/list@2x.jpg?1705253861",
            slimcover: "https://assets.ppy.sh/beatmaps/2115769/covers/slimcover.jpg?1705253861",
            slimcover_2x: "https://assets.ppy.sh/beatmaps/2115769/covers/slimcover@2x.jpg?1705253861"
        },
        creator: "maot",
        favourite_count: 477,
        hype: None,
        id: 2115769,
        nsfw: false,
        offset: 0,
        play_count: 440131,
        preview_url: "//b.ppy.sh/preview/2115769.mp3",
        source: "僕の心のヤバイやつ",
        spotlight: false,
        status: Ranked,
        title: "\"Boku wa...\" (TV Size)",
        title_unicode: "「僕は…」 (TV Size)",
        track_id: None,
        user_id: 3914271,
        video: true,
        bpm: None,
        can_be_hyped: None,
        deleted_at: None,
        discussion_enabled: None,
        discussion_locked: None,
        is_scoreable: None,
        last_updated: None,
        legacy_thread_url: None,
        nominations_summary: None,
        ranked: None,
        ranked_date: None,
        storyboard: None,
        submitted_date: None,
        tags: None,
        availability: None,
        beatmaps: None,
        pack_tags: None,
        converts: None,
        current_nominations: None,
        description: None,
        genre: None,
        language: None,
        ratings: None,
        recent_favourites: None,
        related_users: None,
        related_tags: None,
        user: None
    }),
    weight: Some(Weight {
        percentage: 95.0,
        pp: 28.54978
    })
}, Score {
    accuracy: 0.9829059829059827,
    best_id: Some(219974720),
    created_at: "2025-02-25T11:02:17Z",
    id: 219974720,
    max_combo: 256,
    mode: Catch,
    mode_int: 2,
    mods: [],
    passed: true,
    perfect: false,
    pp: 27.1016,
    rank: S,
    replay: true,
    score: 1752194,
    statistics: Statistics {
        count_100: 0,
        count_300: 367,
        count_50: 323,
        count_geki: None,
        count_katu: 7,
        count_miss: 5
    },
    ranking_type: "score_best_fruits",
    user_id: 31175842,
    current_user_attributes: CurrentUserAttributes {
        pin: None
    },
    beatmap: Some(Beatmap {
        beatmapset_id: 1054381,
        difficulty_rating: 2.12,
        id: 2223069,
        mode: Catch,
        status: Ranked,
        total_length: 95,
        user_id: 2126338,
        version: "papple's Hard",
        accuracy: 6.0,
        ar: 7.7,
        bpm: 97.0,
        convert: true,
        count_circles: 91,
        count_sliders: 133,
        count_spinners: 0,
        cs: 4.0,
        deleted_at: None,
        drain: 5.0,
        hit_length: 94,
        is_scoreable: true,
        last_updated: "2020-01-23T13:50:33Z",
        mode_int: 2,
        passcount: 19782,
        playcount: 49995,
        ranked: 1,
        url: "https://osu.ppy.sh/beatmaps/2223069",
        checksum: "c8cd7fa6f72e593ca4ce1efbc9248411",
        max_combo: None,
        beatmapset: None,
        current_user_tag_ids: None,
        failtimes: None,
        owners: None,
        top_tag_ids: None
    }),
    user: Some(User {
        avatar_url: "https://a.ppy.sh/31175842?1738717996.jpeg",
        country_code: "CN",
        default_group: "default",
        id: 31175842,
        is_active: true,
        is_bot: false,
        is_deleted: false,
        is_online: false,
        is_supporter: false,
        last_visit: "2025-05-11T12:46:15+00:00",
        pm_friends_only: false,
        profile_colour: None,
        username: "Islatri",
        country: None,
        cover: None,
        team: None
    }),
    beatmapset: Some(Beatmapset {
        artist: "Orangestar",
        artist_unicode: "Orangestar",
        covers: Covers {
            cover: "https://assets.ppy.sh/beatmaps/1054381/covers/cover.jpg?1650687705",
            cover_2x: "https://assets.ppy.sh/beatmaps/1054381/covers/cover@2x.jpg?1650687705",
            card: "https://assets.ppy.sh/beatmaps/1054381/covers/card.jpg?1650687705",
            card_2x: "https://assets.ppy.sh/beatmaps/1054381/covers/card@2x.jpg?1650687705",
            list: "https://assets.ppy.sh/beatmaps/1054381/covers/list.jpg?1650687705",
            list_2x: "https://assets.ppy.sh/beatmaps/1054381/covers/list@2x.jpg?1650687705",
            slimcover: "https://assets.ppy.sh/beatmaps/1054381/covers/slimcover.jpg?1650687705",
            slimcover_2x: "https://assets.ppy.sh/beatmaps/1054381/covers/slimcover@2x.jpg?1650687705"
        },
        creator: "Irin",
        favourite_count: 197,
        hype: None,
        id: 1054381,
        nsfw: false,
        offset: 0,
        play_count: 174357,
        preview_url: "//b.ppy.sh/preview/1054381.mp3",
        source: "",
        spotlight: false,
        status: Ranked,
        title: "Nijigen no Onnanoko ni Koi o Shite Shimatte Tsurai...w",
        title_unicode: "二次元の女の子に恋をしてしまって辛い…w",
        track_id: None,
        user_id: 13102983,
        video: false,
        bpm: None,
        can_be_hyped: None,
        deleted_at: None,
        discussion_enabled: None,
        discussion_locked: None,
        is_scoreable: None,
        last_updated: None,
        legacy_thread_url: None,
        nominations_summary: None,
        ranked: None,
        ranked_date: None,
        storyboard: None,
        submitted_date: None,
        tags: None,
        availability: None,
        beatmaps: None,
        pack_tags: None,
        converts: None,
        current_nominations: None,
        description: None,
        genre: None,
        language: None,
        ratings: None,
        recent_favourites: None,
        related_users: None,
        related_tags: None,
        user: None
    }),
    weight: Some(Weight {
        percentage: 90.25,
        pp: 24.459194
    })
}, Score {
    accuracy: 0.9919246298788694,
    best_id: Some(220088619),
    created_at: "2025-03-08T08:21:45Z",
    id: 220088619,
    max_combo: 526,
    mode: Catch,
    mode_int: 2,
    mods: [],
    passed: true,
    perfect: false,
    pp: 23.6235,
    rank: S,
    replay: true,
    score: 9601532,
    statistics: Statistics {
        count_100: 0,
        count_300: 980,
        count_50: 494,
        count_geki: None,
        count_katu: 9,
        count_miss: 3
    },
    ranking_type: "score_best_fruits",
    user_id: 31175842,
    current_user_attributes: CurrentUserAttributes {
        pin: None
    },
    beatmap: Some(Beatmap {
        beatmapset_id: 1974878,
        difficulty_rating: 2.0,
        id: 4098826,
        mode: Catch,
        status: Ranked,
        total_length: 210,
        user_id: 8501291,
        version: "Hard",
        accuracy: 6.4,
        ar: 7.8,
        bpm: 166.0,
        convert: true,
        count_circles: 354,
        count_sliders: 306,
        count_spinners: 1,
        cs: 3.8,
        deleted_at: None,
        drain: 5.0,
        hit_length: 197,
        is_scoreable: true,
        last_updated: "2023-04-24T18:59:04Z",
        mode_int: 2,
        passcount: 133701,
        playcount: 844273,
        ranked: 1,
        url: "https://osu.ppy.sh/beatmaps/4098826",
        checksum: "8834682fb7c3eb24b439b81d6d0c503f",
        max_combo: None,
        beatmapset: None,
        current_user_tag_ids: None,
        failtimes: None,
        owners: None,
        top_tag_ids: None
    }),
    user: Some(User {
        avatar_url: "https://a.ppy.sh/31175842?1738717996.jpeg",
        country_code: "CN",
        default_group: "default",
        id: 31175842,
        is_active: true,
        is_bot: false,
        is_deleted: false,
        is_online: false,
        is_supporter: false,
        last_visit: "2025-05-11T12:46:15+00:00",
        pm_friends_only: false,
        profile_colour: None,
        username: "Islatri",
        country: None,
        cover: None,
        team: None
    }),
    beatmapset: Some(Beatmapset {
        artist: "YOASOBI",
        artist_unicode: "YOASOBI",
        covers: Covers {
            cover: "https://assets.ppy.sh/beatmaps/1974878/covers/cover.jpg?1682362763",
            cover_2x: "https://assets.ppy.sh/beatmaps/1974878/covers/cover@2x.jpg?1682362763",
            card: "https://assets.ppy.sh/beatmaps/1974878/covers/card.jpg?1682362763",
            card_2x: "https://assets.ppy.sh/beatmaps/1974878/covers/card@2x.jpg?1682362763",
            list: "https://assets.ppy.sh/beatmaps/1974878/covers/list.jpg?1682362763",
            list_2x: "https://assets.ppy.sh/beatmaps/1974878/covers/list@2x.jpg?1682362763",
            slimcover: "https://assets.ppy.sh/beatmaps/1974878/covers/slimcover.jpg?1682362763",
            slimcover_2x: "https://assets.ppy.sh/beatmaps/1974878/covers/slimcover@2x.jpg?1682362763"
        },
        creator: "iljaaz",
        favourite_count: 4166,
        hype: None,
        id: 1974878,
        nsfw: false,
        offset: 0,
        play_count: 2904142,
        preview_url: "//b.ppy.sh/preview/1974878.mp3",
        source: "【推し の子】",
        spotlight: false,
        status: Ranked,
        title: "Idol",
        title_unicode: "アイドル",
        track_id: None,
        user_id: 8501291,
        video: true,
        bpm: None,
        can_be_hyped: None,
        deleted_at: None,
        discussion_enabled: None,
        discussion_locked: None,
        is_scoreable: None,
        last_updated: None,
        legacy_thread_url: None,
        nominations_summary: None,
        ranked: None,
        ranked_date: None,
        storyboard: None,
        submitted_date: None,
        tags: None,
        availability: None,
        beatmaps: None,
        pack_tags: None,
        converts: None,
        current_nominations: None,
        description: None,
        genre: None,
        language: None,
        ratings: None,
        recent_favourites: None,
        related_users: None,
        related_tags: None,
        user: None
    }),
    weight: Some(Weight {
        percentage: 85.73749999999998,
        pp: 20.2541983125
    })
}, Score {
    accuracy: 0.9991796554552912,
    best_id: Some(219374861),
    created_at: "2024-12-29T13:51:33Z",
    id: 219374861,
    max_combo: 416,
    mode: Catch,
    mode_int: 2,
    mods: [],
    passed: true,
    perfect: false,
    pp: 23.111,
    rank: S,
    replay: true,
    score: 3148098,
    statistics: Statistics {
        count_100: 78,
        count_300: 483,
        count_50: 657,
        count_geki: None,
        count_katu: 0,
        count_miss: 1
    },
    ranking_type: "score_best_fruits",
    user_id: 31175842,
    current_user_attributes: CurrentUserAttributes {
        pin: None
    },
    beatmap: Some(Beatmap {
        beatmapset_id: 1799847,
        difficulty_rating: 1.66,
        id: 3825769,
        mode: Catch,
        status: Ranked,
        total_length: 185,
        user_id: 636114,
        version: "Cup",
        accuracy: 6.0,
        ar: 6.0,
        bpm: 180.0,
        convert: false,
        count_circles: 125,
        count_sliders: 172,
        count_spinners: 0,
        cs: 2.5,
        deleted_at: None,
        drain: 3.0,
        hit_length: 182,
        is_scoreable: true,
        last_updated: "2022-10-06T14:09:14Z",
        mode_int: 2,
        passcount: 737,
        playcount: 1954,
        ranked: 1,
        url: "https://osu.ppy.sh/beatmaps/3825769",
        checksum: "bb8a7fdd22737645cc7e88fb2a398763",
        max_combo: None,
        beatmapset: None,
        current_user_tag_ids: None,
        failtimes: None,
        owners: None,
        top_tag_ids: None
    }),
    user: Some(User {
        avatar_url: "https://a.ppy.sh/31175842?1738717996.jpeg",
        country_code: "CN",
        default_group: "default",
        id: 31175842,
        is_active: true,
        is_bot: false,
        is_deleted: false,
        is_online: false,
        is_supporter: false,
        last_visit: "2025-05-11T12:46:15+00:00",
        pm_friends_only: false,
        profile_colour: None,
        username: "Islatri",
        country: None,
        cover: None,
        team: None
    }),
    beatmapset: Some(Beatmapset {
        artist: "Yorushika",
        artist_unicode: "ヨルシカ",
        covers: Covers {
            cover: "https://assets.ppy.sh/beatmaps/1799847/covers/cover.jpg?1665065368",
            cover_2x: "https://assets.ppy.sh/beatmaps/1799847/covers/cover@2x.jpg?1665065368",
            card: "https://assets.ppy.sh/beatmaps/1799847/covers/card.jpg?1665065368",
            card_2x: "https://assets.ppy.sh/beatmaps/1799847/covers/card@2x.jpg?1665065368",
            list: "https://assets.ppy.sh/beatmaps/1799847/covers/list.jpg?1665065368",
            list_2x: "https://assets.ppy.sh/beatmaps/1799847/covers/list@2x.jpg?1665065368",
            slimcover: "https://assets.ppy.sh/beatmaps/1799847/covers/slimcover.jpg?1665065368",
            slimcover_2x: "https://assets.ppy.sh/beatmaps/1799847/covers/slimcover@2x.jpg?1665065368"
        },
        creator: "autofanboy",
        favourite_count: 92,
        hype: None,
        id: 1799847,
        nsfw: false,
        offset: 0,
        play_count: 12676,
        preview_url: "//b.ppy.sh/preview/1799847.mp3",
        source: "",
        spotlight: true,
        status: Ranked,
        title: "Gogatsu wa Hana Rokushou no Madobe kara",
        title_unicode: "五月は花緑青の窓 辺から",
        track_id: None,
        user_id: 636114,
        video: false,
        bpm: None,
        can_be_hyped: None,
        deleted_at: None,
        discussion_enabled: None,
        discussion_locked: None,
        is_scoreable: None,
        last_updated: None,
        legacy_thread_url: None,
        nominations_summary: None,
        ranked: None,
        ranked_date: None,
        storyboard: None,
        submitted_date: None,
        tags: None,
        availability: None,
        beatmaps: None,
        pack_tags: None,
        converts: None,
        current_nominations: None,
        description: None,
        genre: None,
        language: None,
        ratings: None,
        recent_favourites: None,
        related_users: None,
        related_tags: None,
        user: None
    }),
    weight: Some(Weight {
        percentage: 81.45062499999999,
        pp: 18.82405394375
    })
}]
*/
