feat: pubg integration
During watching PUBG pro players streams I realized that tons of people asking about their stats, so I decided to add integration with API. It has low limits (10 per minutes but response is complex) that's why I implemented support of multiple api keys and good ttl caching. Also PUBG is ready to expand limits.
The problem is that PUBG needs probably 30 variables about stats and it's to much for one game and only few is really needed. So, I just implemented some of them for testing purposes. Plus, there is maybe too complicated to create right command to show statistic and probably we need to provide default command for it.
Of course, I'm ready to give my api key for production.
Summary by CodeRabbit
-
New Features
- Introduced PUBG integration, allowing users to fetch and display their PUBG player statistics, including lifetime stats and current season information.
- Added support for PUBG API keys in the configuration settings.
- Enhanced the dashboard with a new PUBG component for better user integration experience.
-
Enhancements
- Implemented caching mechanisms for PUBG data to improve performance and user experience.
-
Documentation
- Updated environment variables documentation to include
PUBG_API_KEYS.
- Updated environment variables documentation to include
-
Database Changes
- Executed migrations to support PUBG integration in the system's database.
-
Bug Fixes
- Addressed synchronization issues in data caching to ensure accurate and concurrent data access.
Walkthrough
The integration of PUBG API support enhances the application by incorporating PUBG data alongside existing features. This update includes adding environment variables, configuring settings, and implementing new functionality across various components like the API, parser, and frontend. It introduces a new PUBG client, updates caching mechanisms for PUBG data, and extends the database schema to accommodate PUBG integrations.
Changes
| Files | Change Summary |
|---|---|
.env.example |
Added PUBG_API_KEYS declaration. |
apps/api/app/app.go, apps/parser/cmd/main.go |
Introduced pubg import and initialized pubg.Client. |
apps/api/internal/impl_protected/..., apps/parser/internal/types/services/services.go, apps/api/internal/integrations/integrations.go |
Added PubgClient to structs and updated initialization. |
apps/parser/internal/cacher/cacher.go |
Added PUBG data structures and synchronization mechanisms. |
apps/parser/internal/types/pubg_api.go |
Introduced types for PUBG player statistics and season information. |
apps/parser/internal/variables/... |
Added PUBG lifetime and season statistics handling. |
frontend/dashboard/src/api/integrations/..., frontend/dashboard/src/components/integrations/pubg.vue, frontend/dashboard/src/pages/Integrations.vue |
Implemented PUBG API integration in the frontend. |
libs/api/api.proto, libs/api/messages/integrations_pubg/integrations_pubg.proto |
Added support for PUBG integrations in the API. |
libs/config/config.go, libs/config/src/index.js |
Updated configuration with PubgApiKeys and PUBG_API_KEY. |
libs/gomodels/integrations.go, libs/migrations/migrations/20240315145552_pubg_integration.sql, libs/migrations/seeds/integrations.go |
Added constants and updated the database schema for PUBG integration. |
libs/pubg/pubg.go |
Introduced a package for interacting with the PUBG API. |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>. -
Generate unit-tests for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit tests for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai generate interesting stats about this repository and render them as a table. -
@coderabbitai show all the console.log statements in this repository. -
@coderabbitai read src/utils.ts and generate unit tests. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - The JSON schema for the configuration file is available here.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json
CodeRabbit Discord Community
Join our Discord Community to get help, request features, and share feedback.