Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        /// <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));
        }
Ejemplo n.º 4
0
 public OsuUserBeatmapsRequest(uint id, UserBeatmapType type)
 {
     Id   = id;
     Type = type;
 }
Ejemplo n.º 5
0
 /// <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));
 }