public TypeReaderResult Read(ICommandContext context, string input, IServiceProvider services)
        {
            DivisionWithCategory result;

            if (DivisionWithCategory.TryParse(input, out result) && (!result.Category.HasValue || result.Division == Division.AllService))
            {
                return(TypeReaderResult.FromSuccess(result));
            }

            return(ErrorReturn);
        }
 public Task HistogramCommandAsync(LocationCode location, DivisionWithCategory div, Tier tier) => GenerateHistogramAsync(div, tier, null, location);
 public Task HistogramCommandAsync(string imageName, DivisionWithCategory div, Tier tier) => GenerateHistogramAsync(div, tier, imageName, null);
 public Task HistogramCommandAsync(DivisionWithCategory div, Tier tier) => GenerateHistogramAsync(div, tier, null, null);
 public Task HistogramCommandAsync(string imageName, LocationCode location, DivisionWithCategory div) => GenerateHistogramAsync(div, null, imageName, location);
 public Task GetImageLeaderboardAsync(
     [Summary("The image for which information should be retrieved. The name must be an exact match.")] string imageName,
     [Summary("The location to which scoreboard display should be filtered, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] LocationCode location,
     [Summary("The division (and optionally category) to which scoreboard display should be filtered, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] DivisionWithCategory division,
     [Summary("The tier to which scoreboard display should be filtered, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] Tier tier,
     int pageNumber = 1) => GetImageLeaderboardImplementationAsync(imageName, location, division.Category, division.Division, tier, pageNumber);
 public Task GetImageLeaderboardAsync(string imageName, DivisionWithCategory division, Tier tier, int pageNumber = 1) => GetImageLeaderboardImplementationAsync(imageName, null, division.Category, division.Division, tier, pageNumber);
 public Task GetTeamWithRankCommandAsync(int rank, DivisionWithCategory division, Tier tier) => GetTeamWithRankAsync(rank, null, division, tier);
 public Task GetLeaderboardAsync(
     [Summary("The location to which scoreboard display should be filtered, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] LocationCode location,
     [Summary("The division (and optionally category) to which scoreboard display should be filtered, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] DivisionWithCategory division,
     [Summary("The tier to which scoreboard display should be filtered, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] Tier tier,
     int pageNumber = 1) => GetLeaderboardImplementationAsync(location, division.Category, division.Division, tier, pageNumber);
 public Task GetLeaderboardAsync(DivisionWithCategory division, Tier tier, int pageNumber = 1) => GetLeaderboardImplementationAsync(null, division.Category, division.Division, tier, pageNumber);
 public Task GetLeaderboardAsync(LocationCode location, DivisionWithCategory division, int pageNumber = 1) => GetLeaderboardImplementationAsync(location, division.Category, division.Division, null, pageNumber);
 public Task GetTeamWithPercentileCommandAsync(
     [Summary("The percentile rank, from 0 to 100, for which information should be displayed."), InclusiveRange(0, 100)] double rank,
     [Summary("If provided, the division (and optionally category) within which the percentile will be calculated."), AlterParameterDisplay(DisplayAsOptional = true)] DivisionWithCategory division,
     [Summary("If provided, the tier within which the percentile will be calculated."), AlterParameterDisplay(DisplayAsOptional = true, SubordinateTo = "division")] Tier tier) => GetTeamWithPercentileAsync(rank, division, tier);
 public Task GetTeamWithPercentileCommandAsync([InclusiveRange(0, 100)] double rank, DivisionWithCategory division) => GetTeamWithPercentileAsync(rank, division);
 public Task GetTeamWithRankCommandAsync(
     [Summary("The placement to display. The team at this placement will be displayed. Must be inclusively between 1 and the number of teams.")] int rank,
     [Summary("If provided, the location within which ranking should be calculated."), AlterParameterDisplay(DisplayAsOptional = true)] LocationCode location,
     [Summary("If provided, the division (and optionally category) within which ranking should be calculated."), AlterParameterDisplay(DisplayAsOptional = true)] DivisionWithCategory division,
     [Summary("If provided, the tier within which ranking should be calculated."), AlterParameterDisplay(DisplayAsOptional = true, SubordinateTo = "division")] Tier tier) => GetTeamWithRankAsync(rank, location, division, tier);
 public Task HistogramCommandAsync(
     [Summary("The exact name of the image for which scores should be retrieved. If unspecified, total scores will be used. Only supported on offline score parameters. See the `datasource` command."), AlterParameterDisplay(DisplayAsOptional = true)] string imageName,
     [Summary("The location (either two-letter postal code or three-letter country code, in all caps) to filter the analysis to, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] LocationCode location,
     [Summary("The division (and optionally category) to filter the analysis to, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] DivisionWithCategory div,
     [Summary("The tier to filter the analysis to, if provided."), AlterParameterDisplay(DisplayAsOptional = true)] Tier tier
     ) => GenerateHistogramAsync(div, tier, imageName, location);
 public Task GetImageLeaderboardAsync(string imageName, LocationCode location, DivisionWithCategory division, int pageNumber = 1) => GetImageLeaderboardImplementationAsync(imageName, location, division.Category, division.Division, null, pageNumber);
 public Task GetTeamWithRankCommandAsync(int rank, LocationCode location, DivisionWithCategory division) => GetTeamWithRankAsync(rank, location, division, null);