Skip to content

Add Wargaming.net plugin#87

Open
AnEvilPenguin wants to merge 4 commits into
mainfrom
work/dc/wargaming-plugin
Open

Add Wargaming.net plugin#87
AnEvilPenguin wants to merge 4 commits into
mainfrom
work/dc/wargaming-plugin

Conversation

@AnEvilPenguin

@AnEvilPenguin AnEvilPenguin commented Jul 8, 2026

Copy link
Copy Markdown

Summary

New low-code plugin for the Wargaming.net Public API, covering World of Tanks, World of Warships, and World of Warplanes from a single datasource. A Wargaming account is shared across all three games, so one tracked Player surfaces tank, ship, and aircraft stats side by side.

What's included

  • Object types (5): Player, Clan (cross-game), plus WoT Vehicle, WoWs Ship, WoWp Aircraft encyclopedias.
  • Data streams (14): per-game player summaries (playerSummary, playerWarshipsSummary, playerWarplanesSummary), per-vehicle/ship stats (playerVehicleStats, playerShipStats), clanSummary + clanMembers, the three encyclopedias, accountInfo/clanInfo (import), encyclopediaInfo (config validation), and playerSearch.
  • OOB dashboards (6): Overview (encyclopedia breakdowns + tracked players/clans), a Player perspective with WoT/WoWs/WoWp sections, and Clan / Vehicle / Ship / Aircraft perspectives.
  • Config: Application ID, Realm (EU/NA/Asia), and Account/Clan IDs (chip entry). configValidation probes the API on setup.

Design notes

  • Multi-host, one datasource: baseUrl is the scheme only (https://); each stream carries its full host in endpointPath (api.worldof<game>.{{dataSource.realm}}/...), so all three games work from one datasource.
  • WoWs ship encyclopedia paginates (100/page, ~983 ships) and the platform can't paginate keyed-object responses, so ships are imported via one index step per page.
  • Wargaming API quirks handled: HTTP 200 on errors (errorHandling on error.message), object-keyed data flattened in scripts, epoch-seconds → ISO dates, config fields referenced as {{dataSource.*}}.

Testing

All 14 data streams were tested live against an authenticated datasource (EU realm) — correct per-game host and real data for each. Import verified: WoWs Ship 983, WoWp Aircraft 332, WoT Vehicle 1000, plus tracked Player/Clan. squaredup validate passes.

Notes / limitations

  • Region-bound (one realm per datasource); no historical data (API is cumulative snapshots only); players/clans tracked by explicit ID.
  • World of Warplanes API is flagged x-api-deprecated by Wargaming — still functional.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added new Wargaming default dashboards: Overview, Player, Clan, Vehicle, Ship, and Aircraft.
    • Introduced new data streams for player search, per-title player stats, clan summaries/members, account details, and encyclopedia catalogs (vehicles/ships/planes).
    • Added default scopes, index mappings, custom type definitions, and plugin UI/configuration/metadata scaffolding.
  • Bug Fixes
    • Improved Wargaming API response normalization, date conversion, and more reliable paging/error handling.
    • Hardened win-rate/average calculations with division-by-zero safeguards.
  • Documentation
    • Added/expanded plugin documentation covering setup, realms, supported objects, and limitations.

New low-code plugin covering World of Tanks, World of Warships and World
of Warplanes via the Wargaming.net Public API, from a single datasource.

- Object types: Player and Clan (cross-game), plus WoT Vehicle, WoWs Ship
  and WoWp Aircraft encyclopedias
- 14 data streams: per-game player summaries, per-vehicle/ship stats, clan
  summary + members, encyclopedias, and nickname search
- OOB dashboards: overview, per-game Player perspective, and Clan/Vehicle/
  Ship/Aircraft perspectives
- Multi-host: baseUrl is the scheme only (https://) with each stream's full
  host in endpointPath, so all three games work from one datasource
- WoWs ship encyclopedia paginates (100/page); imported via one step per page

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AnEvilPenguin AnEvilPenguin requested a review from a team July 8, 2026 12:37
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 212df475-629e-4cbe-830f-e5ba40ce61e9

📥 Commits

Reviewing files that changed from the base of the PR and between 98dc5ab and ecde68e.

📒 Files selected for processing (2)
  • plugins/Wargaming.net/v1/dataStreams/playerShipStats.json
  • plugins/Wargaming.net/v1/dataStreams/scripts/playerShipStats.js

📝 Walkthrough

Walkthrough

This PR adds a complete Wargaming.net v1 plugin with metadata, UI configuration, authentication validation, custom types and scopes, player, clan, and encyclopedia data streams, response-processing scripts, index definitions, default dashboards, and documentation.

Changes

Wargaming.net v1 Plugin

Layer / File(s) Summary
Plugin metadata, UI, and authentication
plugins/Wargaming.net/v1/metadata.json, ui.json, configValidation.json, dataStreams/encyclopediaInfo.json
Defines plugin identity and WebAPI settings, configuration fields, and authentication validation through encyclopediaInfo.
Custom types and scopes
custom_types.json, defaultContent/scopes.json
Defines Player, Clan, vehicle, ship, and aircraft types and maps their source types to dashboard variables.
Game data streams and response processing
dataStreams/*.json, dataStreams/scripts/*.js
Adds player, clan, and encyclopedia HTTP streams with metadata, error handling, pagination, response normalization, date conversion, and computed statistics.
Index definitions
indexDefinitions/default.json
Maps vehicles, players, clans, ships, and planes into indexed object properties.
Default dashboards and manifest
defaultContent/*.dash.json, defaultContent/manifest.json
Adds overview and object-specific dashboards for players, clans, vehicles, ships, and aircraft, then registers them in the manifest.
Plugin documentation
docs/README.md
Documents setup, configuration, indexed content, API snapshot behavior, and known limitations.

Sequence Diagram(s)

sequenceDiagram
  participant Dashboard
  participant DataStream
  participant WargamingAPI
  participant PostRequestScript
  Dashboard->>DataStream: Request scoped player, clan, or encyclopedia data
  DataStream->>WargamingAPI: Send authenticated HTTP GET
  WargamingAPI-->>PostRequestScript: Return API payload
  PostRequestScript->>DataStream: Normalize rows and calculate metrics
  DataStream-->>Dashboard: Render stream results
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the Wargaming.net plugin.
Description check ✅ Passed The description includes summary, scope, design notes, testing, and limitations, so it is sufficiently complete for a new plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/Wargaming.net/v1/dataStreams/clanInfo.json`:
- Around line 7-19: The clanInfo stream is missing error mapping, so Wargaming
HTTP-200 error payloads can be treated as empty results. Update the clanInfo
data stream config to add an errorHandling section for the wgn/clans/info
endpoint, following the same pattern used by other Wargaming streams that
inspect clan_id responses. Make sure the new handling routes API error payloads
to a proper stream error instead of returning an empty set.

In `@plugins/Wargaming.net/v1/dataStreams/playerShipStats.json`:
- Around line 10-16: The getArgs in playerShipStats is requesting
last_battle_time even though playerShipStats.js does not use or surface it.
Either remove last_battle_time from the fields list in playerShipStats.json, or
update the playerShipStats.js metadata-building path to expose it as a “Last
Battle” date using the plugin’s existing epoch-to-ISO conversion pattern; use
the playerShipStats/getArgs and playerShipStats.js metadata symbols to locate
the change.

In `@plugins/Wargaming.net/v1/dataStreams/scripts/playerShipStats.js`:
- Around line 4-13: In playerShipStats.js, the result mapping in the ship stats
transform reads p.wins and p.damage_dealt directly while other fields use
defaults, so winRate and avgDamage can become NaN when those subfields are
missing. Update the mapping inside the arr.map callback to apply the same
fallback pattern used for battles/frags, using the existing pvp object and
battles guard to compute winRate and avgDamage safely even when wins or
damage_dealt are absent.

In `@plugins/Wargaming.net/v1/dataStreams/scripts/playerVehicleStats.js`:
- Around line 4-17: The playerVehicleStats mapping has inconsistent default
handling because winRate and avgDamage read raw s.wins and s.damage_dealt while
wins is already normalized, and the wins field itself is not part of the
expected metadata. Update the transformation in playerVehicleStats.js so the
computed values all use the same normalized defaults from the same source
object, and remove the unused wins property if it is not declared in
playerVehicleStats.json metadata. Keep the logic centered around the arr.map
callback and the s/battles calculations.

In `@plugins/Wargaming.net/v1/indexDefinitions/default.json`:
- Around line 36-156: The ships_p1 through ships_p11 index definitions hardcode
a fixed WoWs encyclopedia page count, which will miss any ships beyond the
current last page. Update the Wargaming.net v1 default index setup so the page
count is derived dynamically from the API or generated by iterating until no
more results are returned, and make the change in the
shipsEncyclopedia/page-based index definition block rather than keeping a static
list of pages.

In `@plugins/Wargaming.net/v1/metadata.json`:
- Around line 2-3: The metadata entry has a naming mismatch between the plugin
identifier and its display name; update the `name` field in `metadata.json` to a
lowercase kebab-style value that matches `displayName`’s kebab form, and keep
the `displayName` as-is. Use the `name` and `displayName` fields in
`metadata.json` for the Wargaming plugin to make the identifiers consistent.

In `@plugins/Wargaming.net/v1/ui.json`:
- Line 6: The `applicationId` help text in `ui.json` has a broken markdown link
because the `developers.wargaming.net/applications/` href is missing the
`https://` scheme. Update the help string so the link target is an absolute URL
while keeping the existing link text and surrounding wording intact, using the
`applicationId` help entry as the locator.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 285a2344-123b-4265-9184-ea65c9bf88ed

📥 Commits

Reviewing files that changed from the base of the PR and between 18219a1 and f7bf5e4.

⛔ Files ignored due to path filters (1)
  • plugins/Wargaming.net/v1/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (40)
  • plugins/Wargaming.net/v1/configValidation.json
  • plugins/Wargaming.net/v1/custom_types.json
  • plugins/Wargaming.net/v1/dataStreams/accountInfo.json
  • plugins/Wargaming.net/v1/dataStreams/clanInfo.json
  • plugins/Wargaming.net/v1/dataStreams/clanMembers.json
  • plugins/Wargaming.net/v1/dataStreams/clanSummary.json
  • plugins/Wargaming.net/v1/dataStreams/encyclopediaInfo.json
  • plugins/Wargaming.net/v1/dataStreams/encyclopediaVehicles.json
  • plugins/Wargaming.net/v1/dataStreams/planesEncyclopedia.json
  • plugins/Wargaming.net/v1/dataStreams/playerSearch.json
  • plugins/Wargaming.net/v1/dataStreams/playerShipStats.json
  • plugins/Wargaming.net/v1/dataStreams/playerSummary.json
  • plugins/Wargaming.net/v1/dataStreams/playerVehicleStats.json
  • plugins/Wargaming.net/v1/dataStreams/playerWarplanesSummary.json
  • plugins/Wargaming.net/v1/dataStreams/playerWarshipsSummary.json
  • plugins/Wargaming.net/v1/dataStreams/scripts/accountInfo.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/clanInfo.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/clanMembers.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/clanSummary.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/encyclopediaVehicles.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/planesEncyclopedia.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/playerShipStats.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/playerSummary.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/playerVehicleStats.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/playerWarplanesSummary.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/playerWarshipsSummary.js
  • plugins/Wargaming.net/v1/dataStreams/scripts/shipsEncyclopedia.js
  • plugins/Wargaming.net/v1/dataStreams/shipsEncyclopedia.json
  • plugins/Wargaming.net/v1/defaultContent/aircraft.dash.json
  • plugins/Wargaming.net/v1/defaultContent/clan.dash.json
  • plugins/Wargaming.net/v1/defaultContent/manifest.json
  • plugins/Wargaming.net/v1/defaultContent/overview.dash.json
  • plugins/Wargaming.net/v1/defaultContent/player.dash.json
  • plugins/Wargaming.net/v1/defaultContent/scopes.json
  • plugins/Wargaming.net/v1/defaultContent/ship.dash.json
  • plugins/Wargaming.net/v1/defaultContent/vehicle.dash.json
  • plugins/Wargaming.net/v1/docs/README.md
  • plugins/Wargaming.net/v1/indexDefinitions/default.json
  • plugins/Wargaming.net/v1/metadata.json
  • plugins/Wargaming.net/v1/ui.json

Comment thread plugins/Wargaming.net/v1/dataStreams/clanInfo.json
Comment thread plugins/Wargaming.net/v1/dataStreams/playerShipStats.json
Comment thread plugins/Wargaming.net/v1/dataStreams/scripts/playerShipStats.js
Comment thread plugins/Wargaming.net/v1/dataStreams/scripts/playerVehicleStats.js
Comment thread plugins/Wargaming.net/v1/indexDefinitions/default.json
Comment thread plugins/Wargaming.net/v1/metadata.json
Comment thread plugins/Wargaming.net/v1/ui.json Outdated
AnEvilPenguin and others added 3 commits July 10, 2026 07:51
- clanInfo: add errorHandling for HTTP-200 error payloads, matching
  the pattern used by every other stream on this endpoint family
- ui.json: fix inverted markdown link (URL was in the label, not the href)
- playerShipStats/playerVehicleStats scripts: default wins/damage_dealt
  before dividing, matching the existing battles/frags fallback pattern;
  drop the unused computed `wins` field from playerVehicleStats (dead
  output, not declared in its stream metadata)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replaces the 11 hardcoded ships_p1..p11 index steps with a single
"ships" step that drives its own pagination via a postRequestScript
pagingContext override, since the platform's built-in offset/token
paging can't count rows in the API's keyed-object response body.

Stops on any of: a short page (count !== limit), the total already
covered (page * limit >= total, guarding the case where the real
total is an exact multiple of the page size), or the API's own
PAGE_NO_NOT_FOUND error past the last page. No longer silently caps
out at 1,100 ships if Wargaming's catalog grows.

Verified against a real import: 983/983 ships received and written,
no overshoot, no stray objects.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The field was already requested from the API but never exposed,
per CodeRabbit review feedback on #87.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧩 Plugin PR Summary

📦 Modified Plugins

  • plugins/Wargaming.net/v1

📋 Results

Step Status
Validation ✅ Passed
Deployment 🚀 Deployed

🔍 Validation Details

wargaming
{
  "valid": true,
  "pluginName": "wargaming",
  "pluginType": "hybrid",
  "summary": {
    "Data Streams": 14,
    "Import Definitions": 1,
    "UI Configuration": true,
    "Has Icon": true,
    "Has Default Content": true,
    "Config Validation": true,
    "Custom Types": true
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant