Add Humanizer package

This commit is contained in:
EVAST9919
2017-11-07 12:38:10 +03:00
parent a12052ac51
commit a46dbee532
3 changed files with 49 additions and 15 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Humanizer;
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests
@ -9,28 +10,16 @@ namespace osu.Game.Online.API.Requests
{
private readonly long userId;
private readonly int offset;
private readonly string type;
private readonly BeatmapSetType type;
public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0)
{
this.userId = userId;
this.offset = offset;
switch (type)
{
case BeatmapSetType.Favourite:
this.type = type.ToString().ToLower();
break;
case BeatmapSetType.MostPlayed:
this.type = "most_played";
break;
case BeatmapSetType.RankedAndApproved:
this.type = "ranked_and_approved";
break;
}
this.type = type;
}
protected override string Target => $@"users/{userId}/beatmapsets/{type}?offset={offset}";
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}";
}
public enum BeatmapSetType