Skip to content

Commit 3257469

Browse files
authored
Removed non-existent fields for the summoner name. (#66)
* chore: Remove depricated fields in Riot API models * Removed GetSummonerBy name endpoint. Add Implicit types for constant decleration to be inline with the project and remove compiler warnings.
1 parent 757298b commit 3257469

File tree

4 files changed

+29
-70
lines changed

4 files changed

+29
-70
lines changed

riot/lol/constants.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -57,44 +57,44 @@ type identification string
5757

5858
const (
5959
identificationName identification = "name"
60-
identificationAccountID = "account"
61-
identificationPUUID = "puuid"
62-
identificationSummonerID = "summonerID"
60+
identificationAccountID identification = "account"
61+
identificationPUUID identification = "puuid"
62+
identificationSummonerID identification = "summonerID"
6363
)
6464

6565
type queue string
6666

6767
// All possible queues
6868
const (
6969
QueueRankedSolo queue = "RANKED_SOLO_5x5"
70-
QueueRankedFlex = "RANKED_FLEX_SR"
71-
QueueRankedTwistedTreeline = "RANKED_FLEX_TT"
70+
QueueRankedFlex queue = "RANKED_FLEX_SR"
71+
QueueRankedTwistedTreeline queue = "RANKED_FLEX_TT"
7272
)
7373

7474
type tier string
7575

7676
// All possible Tiers
7777
const (
7878
TierIron tier = "IRON"
79-
TierBronze = "BRONZE"
80-
TierSilver = "SILVER"
81-
TierGold = "GOLD"
82-
TierPlatinum = "PLATINUM"
83-
TierEmerald = "EMERALD"
84-
TierDiamond = "DIAMOND"
85-
TierMaster = "MASTER"
86-
TierGrandMaster = "GRANDMASTER"
87-
TierChallenger = "CHALLENGER"
79+
TierBronze tier = "BRONZE"
80+
TierSilver tier = "SILVER"
81+
TierGold tier = "GOLD"
82+
TierPlatinum tier = "PLATINUM"
83+
TierEmerald tier = "EMERALD"
84+
TierDiamond tier = "DIAMOND"
85+
TierMaster tier = "MASTER"
86+
TierGrandMaster tier = "GRANDMASTER"
87+
TierChallenger tier = "CHALLENGER"
8888
)
8989

9090
type division string
9191

9292
// All possible divisions
9393
const (
9494
DivisionOne division = "I"
95-
DivisionTwo = "II"
96-
DivisionThree = "III"
97-
DivisionFour = "IV"
95+
DivisionTwo division = "II"
96+
DivisionThree division = "III"
97+
DivisionFour division = "IV"
9898
)
9999

100100
var (

riot/lol/model.go

+12-14
Original file line numberDiff line numberDiff line change
@@ -484,18 +484,18 @@ type MatchEventType string
484484
// All legal value for match event types
485485
const (
486486
MatchEventTypeChampionKill MatchEventType = "CHAMPION_KILL"
487-
MatchEventTypeWardPlaced = "WARD_PLACED"
488-
MatchEventTypeWardKill = "WARD_KILL"
489-
MatchEventTypeBuildingKill = "BUILDING_KILL"
490-
MatchEventTypeEliteMonsterKill = "ELITE_MONSTER_KILL"
491-
MatchEventTypeItemPurchased = "ITEM_PURCHASED"
492-
MatchEventTypeItemSold = "ITEM_SOLD"
493-
MatchEventTypeItemDestroyed = "ITEM_DESTROYED"
494-
MatchEventTypeItemUndo = "ITEM_UNDO"
495-
MatchEventTypeSkillLevelUp = "SKILL_LEVEL_UP"
496-
MatchEventTypeAscendedEvent = "ASCENDED_EVENT"
497-
MatchEventTypeCapturePoint = "CAPTURE_POINT"
498-
MatchEventTypePoroKingSummon = "PORO_KING_SUMMON"
487+
MatchEventTypeWardPlaced MatchEventType = "WARD_PLACED"
488+
MatchEventTypeWardKill MatchEventType = "WARD_KILL"
489+
MatchEventTypeBuildingKill MatchEventType = "BUILDING_KILL"
490+
MatchEventTypeEliteMonsterKill MatchEventType = "ELITE_MONSTER_KILL"
491+
MatchEventTypeItemPurchased MatchEventType = "ITEM_PURCHASED"
492+
MatchEventTypeItemSold MatchEventType = "ITEM_SOLD"
493+
MatchEventTypeItemDestroyed MatchEventType = "ITEM_DESTROYED"
494+
MatchEventTypeItemUndo MatchEventType = "ITEM_UNDO"
495+
MatchEventTypeSkillLevelUp MatchEventType = "SKILL_LEVEL_UP"
496+
MatchEventTypeAscendedEvent MatchEventType = "ASCENDED_EVENT"
497+
MatchEventTypeCapturePoint MatchEventType = "CAPTURE_POINT"
498+
MatchEventTypePoroKingSummon MatchEventType = "PORO_KING_SUMMON"
499499
)
500500

501501
var (
@@ -596,7 +596,6 @@ type Observer struct {
596596
type CurrentGameParticipant struct {
597597
ProfileIconID int `json:"profileIconId"`
598598
ChampionID int `json:"championId"`
599-
SummonerName string `json:"summonerName"`
600599
GameCustomizationObjects []*GameCustomizationObject `json:"gameCustomizationObjects"`
601600
Bot bool `json:"bot"`
602601
Perks *Perks `json:"perks"`
@@ -688,7 +687,6 @@ type StatusTranslation struct {
688687
// Summoner represents a summoner with several related IDs
689688
type Summoner struct {
690689
ProfileIconID int `json:"profileIconId"`
691-
Name string `json:"name"`
692690
PUUID string `json:"puuid"`
693691
SummonerLevel int `json:"summonerLevel"`
694692
RevisionDate int `json:"revisionDate"`

riot/lol/summoner.go

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ type SummonerClient struct {
1313
c *internal.Client
1414
}
1515

16-
// GetByName returns the summoner with the given summoner name
17-
func (s *SummonerClient) GetByName(name string) (*Summoner, error) {
18-
return s.getBy(identificationName, name, s.logger().WithField("method", "GetByName"))
19-
}
20-
2116
// GetByAccountID returns the summoner with the given account ID
2217
func (s *SummonerClient) GetByAccountID(id string) (*Summoner, error) {
2318
return s.getBy(identificationAccountID, id, s.logger().WithField("method", "GetByAccountID"))

riot/lol/summoner_test.go

-34
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,6 @@ import (
1212
"github.com/KnutZuidema/golio/internal/mock"
1313
)
1414

15-
func TestSummonerClient_GetByName(t *testing.T) {
16-
t.Parallel()
17-
tests := []struct {
18-
name string
19-
doer internal.Doer
20-
want *Summoner
21-
wantErr error
22-
}{
23-
{
24-
name: "get response",
25-
want: &Summoner{},
26-
doer: mock.NewJSONMockDoer(&Summoner{}, 200),
27-
},
28-
{
29-
name: "not found",
30-
wantErr: api.ErrNotFound,
31-
doer: mock.NewStatusMockDoer(http.StatusNotFound),
32-
},
33-
}
34-
for _, tt := range tests {
35-
t.Run(
36-
tt.name, func(t *testing.T) {
37-
var err error
38-
client := internal.NewClient(api.RegionEuropeWest, "API_KEY", tt.doer, logrus.StandardLogger())
39-
got, err := (&SummonerClient{c: client}).GetByName("name")
40-
assert.Equal(t, err, tt.wantErr)
41-
if tt.wantErr == nil {
42-
assert.Equal(t, got, tt.want)
43-
}
44-
},
45-
)
46-
}
47-
}
48-
4915
func TestSummonerClient_GetByAccountID(t *testing.T) {
5016
t.Parallel()
5117
tests := []struct {

0 commit comments

Comments
 (0)