public static string ToParamString(this UserBeatmapType beatmapType) { switch (beatmapType) { case UserBeatmapType.Favourite: return("favourite"); case UserBeatmapType.Graveyard: return("graveyard"); case UserBeatmapType.Loved: return("loved"); case UserBeatmapType.MostPlayed: return("most_played"); case UserBeatmapType.RankedAndApproved: return("ranked_and_approved"); case UserBeatmapType.Unranked: return("unranked"); default: throw new ArgumentOutOfRangeException(nameof(beatmapType), beatmapType, null); } }
public Beatmapset[] GetUserBeatmap(string user, UserBeatmapType type) { string route = $"/users/{HttpUtility.UrlEncode(user)}/beatmapsets/{type.ToParamString()}?limit=500&offset=0"; var json = _httpClient.HttpGet(OsuClientV2.BaseUri + route); var obj = JsonConvert.DeserializeObject <Beatmapset[]>(json); return(obj); }
/// <summary> /// Get a user's published maps /// </summary> /// <param name="client">The <see cref="OrbitClient"/></param> /// <param name="id">The id of the user</param> /// <param name="type">The <see cref="UserBeatmapType"/> to filter responses by</param> /// <param name="limit">Optional limit to cap responses</param> /// <param name="page">Optional page number to fetch reliant on the <see cref="limit"/></param> public static Task <IEnumerable <OsuBeatmapset> > GetUserMaps(this OrbitClient client, uint id, UserBeatmapType type, uint?limit = null, uint page = 0) { var request = new OsuUserBeatmapsRequest(id, type) { Limit = limit, Page = page }; return(client.PerformAsync <IEnumerable <OsuBeatmapset> >(request)); }
public OsuUserBeatmapsRequest(uint id, UserBeatmapType type) { Id = id; Type = type; }
/// <summary> /// Get a user's published maps /// </summary> /// <param name="client">The <see cref="OrbitClient"/></param> /// <param name="user">The user to get maps by</param> /// <param name="type">The <see cref="UserBeatmapType"/> to filter responses by</param> /// <param name="limit">Optional limit to cap responses</param> /// <param name="page">Optional page number to fetch reliant on the <see cref="limit"/></param> public static Task <IEnumerable <OsuBeatmapset> > GetUserMaps(this OrbitClient client, OsuUserCard user, UserBeatmapType type, uint?limit = null, uint page = 0) { return(client.GetUserMaps(user.Id, type, limit, page)); }