Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/bruno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Bruno Run

on:
workflow_dispatch:
push:
branches: [ "main" ]
paths: [ '!bruno/**' , '!.github/**' ]
pull_request:
branches: [ "main", "dev" ]

jobs:
bruno:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Check out repository code and Install
uses: actions/checkout@v4
- run: npm install
- run: npm run generateoas
- run: npm start & npx wait-on http://localhost:3000
- run: npm test
Comment on lines +13 to +25

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 23 days ago

In general, this issue is fixed by adding an explicit permissions block that scopes the GITHUB_TOKEN to the least privileges required. This can be done either at the workflow root (applies to all jobs) or within the specific job. Since this workflow has a single job and appears to only need read access to clone the repository, contents: read is sufficient as a minimal starting point.

The best fix without changing existing functionality is to add a permissions section at the workflow root, directly under the name: (or on:) key. This will apply to all jobs (currently only bruno) and ensure the GITHUB_TOKEN is restricted to repository contents read access, which is enough for actions/checkout and typical Node-based CI steps. No additional imports, methods, or definitions are required—this is purely a YAML configuration change in .github/workflows/bruno.yml, around lines 1–4, adding:

permissions:
  contents: read
Suggested changeset 1
.github/workflows/bruno.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/bruno.yml b/.github/workflows/bruno.yml
--- a/.github/workflows/bruno.yml
+++ b/.github/workflows/bruno.yml
@@ -1,5 +1,8 @@
 name: Bruno Run
 
+permissions:
+  contents: read
+
 on:
   workflow_dispatch:
   push:
EOF
@@ -1,5 +1,8 @@
name: Bruno Run

permissions:
contents: read

on:
workflow_dispatch:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
25 changes: 0 additions & 25 deletions .github/workflows/newman.yml

This file was deleted.

1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
109 changes: 109 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# AGENTS.md - Agentic Coding Guide for Google Play API

## Project Overview
REST API wrapper around google-play-scraper for fetching Google Play Store data. Express.js application using ES modules.

## Build/Lint/Test Commands

```bash
# Install dependencies
npm install

# Start development server (port 3000)
npm start

# Run all tests (Newman Postman collections)
npm test

# Generate OpenAPI spec from Postman collections
npm run generateoas

# Lint code (semistandard style)
npx eslint .

# Auto-fix linting issues
npx eslint . --fix
```

**Note**: No single test runner available. Tests use Newman with Postman collections in `PostmanCollections/`.

## Code Style Guidelines

### ESLint Configuration
- **Extends**: `semistandard` (semicolons required)
- **Environment**: ES6, Node.js, Mocha
- **Key Rule**: `no-unused-vars` flags all unused variables

### Formatting
- Use semicolons at end of statements
- 2-space indentation
- Single quotes for strings
- No trailing spaces

### Naming Conventions
- Variables/functions: `camelCase`
- Constants: `UPPER_CASE` for true constants
- Files: `kebab-case.js` (e.g., `index.js`)

### Imports/Modules
- ES modules only (`"type": "module"` in package.json)
- Use single quotes: `import Express from 'express'`
- Group imports: core modules → external → internal

### Error Handling
- Use Express error middleware: `(err, req, res, next) => {...}`
- Pass errors with `next(err)`
- 404 for "App not found", 400 for other bad requests
- Include error message in JSON response

### Code Patterns
- Use `'use strict'` at top of files
- Prefer `const` and `let` over `var`
- Use arrow functions: `(req, res, next) => {...}`
- Promise chains: `.then().catch(next)` pattern
- Destructuring: `const { param1, param2 } = req.query`

### Route Patterns
```javascript
router.get('/endpoint', function (req, res, next) {
const opts = Object.assign({ default: 'value' }, req.query);
gplay.method(opts)
.then(transformData)
.then(toList)
.then(res.json.bind(res))
.catch(next);
});
```

## Environment Configuration
Copy `.env.sample` to `.env`:
- `PORT`: Server port (default: 3000)
- `COUNTRY_OF_QUERY`: Default country for queries (default: IN)
- `LOGGING`: Enable HTTP logging (default: true)
- `RATE_LIMIT_*`: Rate limiting configuration

## Project Structure
```
├── server.js # Express app entry point
├── lib/
│ └── index.js # API route handlers
├── test.js # Newman test runner
├── PostmanCollections/# Test collections
├── openapi/ # Swagger/OpenAPI specs
├── .eslintrc # Linting config
└── Dockerfile # Container config
```

## Key Dependencies
- `express`: Web framework
- `google-play-scraper`: Core scraping library
- `cors`: CORS middleware
- `express-rate-limit`: Rate limiting
- `newman`: Postman test runner

## API Conventions
- Base path: `/api/`
- JSON responses only
- Use `toList()` wrapper: `{ results: [...] }`
- `cleanUrls()` helper for consistent URL generation
- Support `country` query param for localization
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [1.6.1] - 2026-02-11

### Fixed
- **Privacy bug**: `userImage` field was not being properly filtered when `userdata=false` query parameter was used in reviews endpoint. Changed `_userImage` to `userImage` in `lib/index.js` destructuring pattern (line 198).
- **Test runner**: Modified `test.js` to automatically start and stop the server before/after running Newman tests, eliminating `ECONNREFUSED` errors.

### Changed
- **DataSafety tests**: Updated Postman collection tests to handle current Google Play Store data format where Wikipedia app now returns empty `privacyPolicyUrl` and `securityPractices` arrays.

### Tests
- All 99 assertions now passing (28 in GPlayAPIUnitTests + 71 in GooglePlayAPI collection)
- Fixed 3 privacy-related test failures
- Fixed 2 DataSafety test failures (Wikipedia app data changes)

## [1.6.0] - 2025-12-02

### Added
Expand Down
18 changes: 9 additions & 9 deletions PostmanCollections/GooglePlayAPI.postman_collection.json

Large diffs are not rendered by default.

33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Google Play API
![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/srikanthlogic/google-play-api?include_prereleases&label=version) [![Newman Run](https://github.com/srikanthlogic/google-play-api/actions/workflows/newman.yml/badge.svg)](https://github.com/srikanthlogic/google-play-api/actions/workflows/newman.yml) [![API Documentation](https://img.shields.io/badge/api-documentation-brightgreen)](https://gplayapi.cashlessconsumer.in/) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/srikanthlogic/google-play-api?include_prereleases&label=version) [![Bruno Run](https://github.com/srikanthlogic/google-play-api/actions/workflows/bruno.yml/badge.svg)](https://github.com/srikanthlogic/google-play-api/actions/workflows/bruno.yml) [![API Documentation](https://img.shields.io/badge/api-documentation-brightgreen)](https://gplayapi.cashlessconsumer.in/) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)

Google Play API is a REST API wrapper originally built on top of [google-play-scraper](https://github.com/facundoolano/google-play-scraper) by [Facundoolano](https://github.com/facundoolano) to fetch metadata from [Google Play](https://en.wikipedia.org/wiki/Google_Play). This repository extends it and adds additional endpoints.

Expand Down Expand Up @@ -113,10 +113,39 @@ For complete API documentation, including all endpoints, parameters, and respons
- **Interactive Documentation**: [https://gplayapi.cashlessconsumer.in/](https://gplayapi.cashlessconsumer.in/)
- **Local Documentation**: http://localhost:3000/api-docs (when running locally)

## Test Coverage

The project uses [Bruno](https://www.usebruno.com/) for API testing with comprehensive test coverage. Bruno is a Git-friendly, open-source API client that stores API requests as plain text files.

| Test Suite | Requests | Assertions | Status |
|------------|----------|------------|--------|
| GPlayAPIUnitTests | 5 | 28 | ✅ All Pass |
| GooglePlayAPI | 12 | 71 | ✅ All Pass |
| **Total** | **17** | **99** | **✅ 100%** |

### Running Tests

```bash
npm test
```

This will:
1. Start the server automatically
2. Execute all Bruno collections
3. Report test results
4. Shut down the server

### Test Structure

Tests are organized in the `bruno/` directory:
- `bruno/GooglePlayAPI/` - Main API endpoint tests (Apps, Developers, Categories, Lists, Collections)
- `bruno/GPlayAPIUnitTests/` - Unit tests for privacy features and app reviews
- `bruno/*/environments/Local.bru` - Environment variables for local testing

## Contributing

For detailed information about contributing to this project, including development setup, code style guidelines, and the contribution process, please see our [Development Guide](DEVELOP.md).

## License

This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Loading
Loading