KnutZuidema / golio

League of Legends, Legends of Runeterra and Valorant API client library for Go
MIT License
72 stars 29 forks source link

Improve TFT support #47

Closed jonathanschmittblog closed 1 year ago

jonathanschmittblog commented 3 years ago

client := golio.NewClient(riotAPI, golio.WithRegion(api.Region(_summoners[i].REGION)), golio.WithLogger(logrus.New().WithField("foo", "bar")))

summoner, err := client.Riot.TfT.Summoner.GetByName("summoner_name") if err != nil { return; }

leagues, err2 := client.Riot.TfT.League.ListBySummoner(summoner.ID) if err2 != nil { return; } var r string name := strings.ToUpper(summoner.Name) if len(leagues) > 0 { r = "" for i := 0; i < len(leagues); i++ { if strings.Contains(leagues[i].QueueType, "RANKED_TFT") { r = string(leagues[i].Tier) + " " + leagues[i].Rank + " (" + strconv.Itoa(leagues[i].LeaguePoints) + " LP)" result = r; } } } else { r = "UNRANKED (LVL " + strconv.Itoa(summoner.SummonerLevel) + ")" result = r; }

codecov[bot] commented 3 years ago

Codecov Report

Merging #47 (c304151) into master (6718371) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master       #47    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           21        32    +11     
  Lines          821      1122   +301     
==========================================
+ Hits           821      1122   +301     
Impacted Files Coverage Δ
riot/tft/champion.go 100.00% <100.00%> (ø)
riot/tft/champion_mastery.go 100.00% <100.00%> (ø)
riot/tft/client.go 100.00% <100.00%> (ø)
riot/tft/league.go 100.00% <100.00%> (ø)
riot/tft/match.go 100.00% <100.00%> (ø)
riot/tft/model.go 100.00% <100.00%> (ø)
riot/tft/spectator.go 100.00% <100.00%> (ø)
riot/tft/status.go 100.00% <100.00%> (ø)
riot/tft/summoner.go 100.00% <100.00%> (ø)
riot/tft/third_party_code.go 100.00% <100.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6718371...c304151. Read the comment docs.

KnutZuidema commented 3 years ago

Hi and thank you for working on adding support for TFT. It looks like right now you just copied the code from the LOL client. In order for me to add something like this it would have to be build according to the available API endpoints that you can find here: https://developer.riotgames.com/apis.