Skip to content

Commit

Permalink
[api] Update endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
IceflowRE committed May 15, 2024
1 parent 910bc1d commit 0ab0a4f
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 366 deletions.
38 changes: 27 additions & 11 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

4.1.5
=====

Updated
-------

- wot: ``acount/info``
- wot: ``tank/stats``

Removed
-------

- wgn: ``wgtv/tags``
- wgn: ``wgtv/vehicles``
- wgn: ``wgtv/videos``

4.1.4
=====

Expand All @@ -17,12 +33,12 @@ Updated
Removed
-------

- `wotb_clanmessages_create`
- `wotb_clanmessages_delete`
- `wotb_clanmessages_like`
- `wotb_clanmessages_likes`
- `wotb_clanmessages_messages`
- `wotb_clanmessages_update`
- wotb: ``clanmessages/create``
- wotb:``clanmessages/delete``
- wotb:``clanmessages/like``
- wotb:``clanmessages/likes``
- wotb:``clanmessages/messages``
- wotb:``clanmessages/update``

4.1.3
=====
Expand All @@ -48,16 +64,16 @@ Changed
Fixed
-----

- `wot_encyclopedia_vehicles` patch some return types
- wot: ``encyclopedia/vehicles`` patch some return types

4.1.1
=====

Fixed
-----

- `wot_account_tanks` return type (again)
- `wot_encyclopedia_vehicles` return type
- wot: ``account/tanks`` return type (again)
- wot: ``encyclopedia/vehicles`` return type

4.1.0
=====
Expand All @@ -70,7 +86,7 @@ Updated
Fixed
-----

- `wot_account_tanks` return type
- wot: ``account/tanks`` return type

4.0.1
=====
Expand Down Expand Up @@ -167,4 +183,4 @@ Replaced
Changed
-------

- ``wot/globalmap/eventaccountinfo`` made ``account_id`` optional (either ``account_id`` or ``clan_id`` is required.
- wot: ``globalmap/eventaccountinfo`` made ``account_id`` optional (either ``account_id`` or ``clan_id`` is required.
10 changes: 3 additions & 7 deletions tools/generator/internal/patches.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ func patchEndpoint(ep *endpoint) {
ep.DataType.F("Guns").F("Shells").TypeStr = "[]*struct"
ep.DataType.F("Suspensions").TypeStr = "[]*struct"
ep.DataType.F("Turrets").TypeStr = "[]*struct"
case "wgn_wgtv_tags":
ep.DataType.F("Categories").TypeStr = "[]*struct"
ep.DataType.F("Projects").TypeStr = "[]*struct"
ep.DataType.F("Programs").TypeStr = "[]*struct"
case "wot_clans_messageboard":
ep.DataType.TypeStr = "map[string][]" + ep.DataType.TypeStr
case "wotb_tournaments_teams":
Expand All @@ -91,7 +87,7 @@ func patchEndpoint(ep *endpoint) {
}

if slices.Contains([]string{
"wgn_account_list", "wgn_wgtv_videos",
"wgn_account_list",
"wot_account_list", "wot_clans_list",
"wot_clanratings_neighbors", "wot_clanratings_top", "wot_globalmap_clanbattles",
"wot_globalmap_eventaccountratingneighbors", "wot_globalmap_eventaccountratings", "wot_globalmap_eventrating",
Expand Down Expand Up @@ -140,7 +136,7 @@ func patchMeta(ep *endpoint) {
"wows_encyclopedia_accountlevels", "wows_encyclopedia_crews", "wows_encyclopedia_crewranks",
"wows_encyclopedia_battletypes", "wows_encyclopedia_collections", "wows_encyclopedia_collectioncards",
"wows_encyclopedia_battlearenas", "wows_clans_info", "wows_clans_accountinfo", "wows_clans_season",
"wgn_account_list", "wgn_account_info", "wgn_wgtv_tags", "wgn_wgtv_vehicles",
"wgn_account_list", "wgn_account_info",

"wows_account_info", "wows_account_achievements", "wows_account_statsbydate", "wows_ships_stats",
"wows_seasons_shipstats", "wows_seasons_accountinfo",
Expand All @@ -154,7 +150,7 @@ func patchMeta(ep *endpoint) {

"wot_encyclopedia_vehicles", "wot_encyclopedia_provisions", "wot_encyclopedia_modules",
"wotx_encyclopedia_vehicles", "wows_encyclopedia_ships", "wows_encyclopedia_modules",
"wows_encyclopedia_consumables", "wgn_wgtv_videos",
"wows_encyclopedia_consumables",
}, ep.Id) {
ep.MetaType = &goType{
Name: "",
Expand Down
26 changes: 4 additions & 22 deletions wargaming/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ package wargaming
import (
"context"
"errors"
"github.com/IceflowRE/go-wargaming/v4/wargaming/wgn"
"github.com/IceflowRE/go-wargaming/v4/wargaming/wot"
"github.com/IceflowRE/go-wargaming/v4/wargaming/wotx"
"net/http"
"os"
"strings"
"testing"
"time"

"github.com/IceflowRE/go-wargaming/v4/wargaming/wot"
"github.com/IceflowRE/go-wargaming/v4/wargaming/wotx"
)

var apiId = os.Getenv("WARGAMING_API_ID")
Expand Down Expand Up @@ -82,7 +82,7 @@ func ToSnake(camel string) (snake string) {
// add underscore when next letter is lowercase
if (i != 0 || i == l-1) && ( // head and tail
(i > 0 && rune(camel[i-1]) >= 'a') || // pre
(i < l-1 && rune(camel[i+1]) >= 'a')) { //next
(i < l-1 && rune(camel[i+1]) >= 'a')) { // next
b.WriteRune('_')
}
b.WriteRune(v + diff)
Expand Down Expand Up @@ -836,24 +836,6 @@ func TestApi(test *testing.T) {
skipTest("WgnWargagRate", reasonTooComplex, test)
skipTest("WgnWargagNewcomment", reasonTooComplex, test)
skipTest("WgnWargagDeletecomment", reasonTooComplex, test)
test.Run(ToSnake("WgnWgtvTags"), func(test *testing.T) {
_, _, err := client.Wgn.WgtvTags(context.Background(), RealmEu, nil)
checkErr(test, err)
})
delay()
test.Run(ToSnake("WgnWgtvVideos"), func(test *testing.T) {
_, _, err := client.Wgn.WgtvVideos(context.Background(), RealmEu, &wgn.WgtvVideosOptions{
Limit: Int(3),
PageNo: Int(1),
})
checkErr(test, err)
})
delay()
test.Run(ToSnake("WgnWgtvVehicles"), func(test *testing.T) {
_, _, err := client.Wgn.WgtvVehicles(context.Background(), RealmEu, nil)
checkErr(test, err)
})
delay()
test.Run(ToSnake("WgnServersInfo"), func(test *testing.T) {
_, err := client.Wgn.ServersInfo(context.Background(), RealmEu, nil)
checkErr(test, err)
Expand Down
2 changes: 1 addition & 1 deletion wargaming/sections.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
sectionWotb = sectionS{
apiUrlFormat: "https://api.wotblitz.%s/wotb",
}
// sectionWotx World Of Tanks Console.
// sectionWotx World Of Tanks Modern Armor.
sectionWotx = sectionS{
apiUrlFormat: "https://api-console.worldoftanks.%s/wotx",
}
Expand Down
4 changes: 2 additions & 2 deletions wargaming/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type WotService service
// WotbService World Of Tanks Blitz service.
type WotbService service

// WotxService World Of Tanks Console service.
// WotxService World Of Tanks Modern Armor service.
type WotxService service

// WowpService World Of Warplanes service.
Expand All @@ -27,7 +27,7 @@ type wgServices struct {
Wot *WotService
// World Of Tanks Blitz
Wotb *WotbService
// World Of Tanks Console
// World Of Tanks Modern Armor
Wotx *WotxService
// World Of Warplanes
Wowp *WowpService
Expand Down
54 changes: 0 additions & 54 deletions wargaming/wgn/wgtv_tags.go

This file was deleted.

17 changes: 0 additions & 17 deletions wargaming/wgn/wgtv_vehicles.go

This file was deleted.

84 changes: 0 additions & 84 deletions wargaming/wgn/wgtv_videos.go

This file was deleted.

38 changes: 0 additions & 38 deletions wargaming/wgn_wgtv_tags.go

This file was deleted.

Loading

0 comments on commit 0ab0a4f

Please sign in to comment.