<commit_before>package goriot

import (
	"fmt"
	"strconv"
)

//League represents a League of Legends league
type League struct {
	Entries []LeagueItem `json:"entries"`
	Name    string       `json:"name"`
	Queue   string       `json:"queue"`
	Tier    string       `json:"tier"`
}

//LeagueItem is an entry in a League. It represents a player or team
type LeagueItem struct {
	IsFreshBlood     bool       `json:"isFreshBlood"`
	IsHotStreak      bool       `json:"isHotStreak"`
	IsInactive       bool       `json:"isInactive"`
	IsVeteran        bool       `json:"isVeteran"`
	LastPlayed       int64      `json:"lastPlayed"`
	LeagueName       string     `json:"leagueName"`
	LeaguePoints     int        `json:"leaguePoints"`
	MiniSeries       MiniSeries `json:"miniSeries"`
	PlayerOrTeamID   string     `json:"playerOrTeamId"`
	PlayerOrTeamName string     `json:"playerOrTeamName"`
	QueueType        string     `json:"queueType"`
	Rank             string     `json:"rank"`
	Tier             string     `json:"tier"`
	Wins             int        `json:"wins"`
}

//MiniSeries shows if a player is in their Series and how far they are within it
type MiniSeries struct {
	Losses               int    `json:"losses"`
	Progress             string `json:"progress"`
	Target               int    `json:"target"`
	TimeLeftToPlayMillis int64  `json:"timeLeftToPlayMillis"`
	Wins                 int    `json:"wins"`
}

//LeagueBySummoner retrieves the league of the supplied summonerID from Riot Games API.
//It returns a League and any errors that occured from the server
//The global API key must be set before use
func LeagueBySummoner(region string, summonerID int64) (league League, err error) {
	tempMap := make(map[string]League)
	if !IsKeySet() {
		return league, ErrAPIKeyNotSet
	}
	summonerIDstr := strconv.FormatInt(summonerID, 10)
	args := "api_key=" + apikey
	url := fmt.Sprintf("%v/lol/%v/v2.2/league/by-summoner/%d?%v", BaseURL, region, summonerID, args)
	err = requestAndUnmarshal(url, &tempMap)
	if err != nil {
		return
	}
	return tempMap[summonerIDstr], err
}
<commit_msg>Upgrades Leagues to API Version 2.3<commit_after>package goriot

import (
	"fmt"
)

//League represents a League of Legends league
type League struct {
	Entries       []LeagueItem `json:"entries"`
	Name          string       `json:"name"`
	ParticipantId string       `json:"participantId"`
	Queue         string       `json:"queue"`
	Tier          string       `json:"tier"`
}

//LeagueItem is an entry in a League. It represents a player or team
type LeagueItem struct {
	IsFreshBlood     bool       `json:"isFreshBlood"`
	IsHotStreak      bool       `json:"isHotStreak"`
	IsInactive       bool       `json:"isInactive"`
	IsVeteran        bool       `json:"isVeteran"`
	LastPlayed       int64      `json:"lastPlayed"`
	LeagueName       string     `json:"leagueName"`
	LeaguePoints     int        `json:"leaguePoints"`
	MiniSeries       MiniSeries `json:"miniSeries"`
	PlayerOrTeamID   string     `json:"playerOrTeamId"`
	PlayerOrTeamName string     `json:"playerOrTeamName"`
	QueueType        string     `json:"queueType"`
	Rank             string     `json:"rank"`
	Tier             string     `json:"tier"`
	Wins             int        `json:"wins"`
}

//MiniSeries shows if a player is in their Series and how far they are within it
type MiniSeries struct {
	Losses               int    `json:"losses"`
	Progress             string `json:"progress"`
	Target               int    `json:"target"`
	TimeLeftToPlayMillis int64  `json:"timeLeftToPlayMillis"`
	Wins                 int    `json:"wins"`
}

//LeagueBySummoner retrieves the league of the supplied summonerID from Riot Games API.
//It returns a League and any errors that occured from the server
//The global API key must be set before use
func LeagueBySummoner(region string, summonerID int64) (league []League, err error) {
	if !IsKeySet() {
		return league, ErrAPIKeyNotSet
	}
	args := "api_key=" + apikey
	url := fmt.Sprintf("%v/lol/%v/v2.3/league/by-summoner/%d?%v", BaseURL, region, summonerID, args)
	err = requestAndUnmarshal(url, &league)
	if err != nil {
		return
	}
	return league, err
}

{'fraction_non_alphanumeric': 0.10147378593863252, 'fraction_numerical': 0.004832085044696787, 'mean_word_length': 2.822714681440443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1809515', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1275, 'n_words': 382}